Sorry, but I do not understand what you hope to achieve. A struct is just a description of a block of memory that contains a fixed set of bytes, words etc. If it is 20 bytes long then you must describe each part exactly so the compiler can calculate the offsets correctly. Leaving blank space and expecting the compiler to guess what is missing makes no sense.
That is irrelevant; this discussion is about the struct definition. What you do with the content is dependent on your code, but the definition (as I keep repeating) must include every element of the block of memory.
I like C but I feel it's Achilles heel is string processing. I've started to do a lot of parsing of text databases in arbitrary format without documentation lately and I need to adapt.
What I need to do is define patterns - expected format for the data and to store the values only if the whole string matches that known pattern. Input validation.
I'd rather not run the rest of my code without verifying the input conforms.
I think regular expressions are the best way to augment my existing skills without learning a new language, but regexes seem kind of varied and mixed breed.
Perl (5?) Seems to have formal standardization of regexes which is supported in many searching and text editing programs. There's also PCRE which I can compile on windows or download precompiled lib/dll.
Should I learn Perl regexes and use PCRE or am I overlooking things?
PCRE is a good option. It is based on the Perl regexe, although there are some minor differences under the hood (which I do not remember now). I wrote my own C++ template regex some years ago that gives me full control of behavior in my personal projects. I used other libraries like PCRE, for comparison, in my test bed, to test for speed and accuracy. That is why I know that there are some minor differences on what one considers valid and invalid syntax (implementation differences or programmers mind set - who knows?).
As for Cs ability to process strings or any other data type - it is very efficient. I used to be able to look a C-code and translate it, in my head, directly to the equivalent assembly code. What you are talking about is the standard C libraries, which were designed to provide only the simple low level functionality that programmers require to develop more complex algorithms (how many ways are there to write a 'strcmp' function?). It was left to others to provide libraries that required more than a simple 'for' or while 'loop' in their functions.
That being said, when I find my self doing contract work on old C-code, where I am not allowed to upgrade or use external libraries, I recreate some simple algorithms for parsing (hey its their money, so who am I to argue with a brick wall). Basically, I create equivalent functions for parsing sub-strings like the regex "\d*" or "[abd]" and wrap them in a function call - depending on what I am looking for. What little testing I have done has actually shown me that they were more efficient than using the MS implementation of regex (not a surprise).
Conclusion: C is the most efficient language I have ever work with - there is a reason that all of the modern operating systems, I have worked with, were written in C. (I have not checked lately, so it is possible that C++ snuck in their some were).
"Program testing can be used to show the presence of bugs, but never to show their absence." - Edsger Dijkstra
"I have never been lost, but I will admit to being confused for several weeks. " - Daniel Boone
Freshly installed Windows 10 and VS2017 enterprise and doing migration from VS2010 to VS2017. Getting fatal error C1083: Cannot open include file: 'atlapp.h: No such file or direectory when i compile one of the project, even i have selected ATL and required options during VC2017 installation.
I would appreciate if anyone can suggest how to resolve this issue.
Thanks & Regards
However, a frame window should not contain controls. It is - as the name indicates - a frame for other windows which are CView based or - for the main frame - child frames which then have their views. So your edit control should be part of a CView based window.
I use Visual Studio 2015.
Projekt setting: Use MFC in a Shared DLL.
For building from command line is used:
msbuild .\my_project.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64
All is working well, build runs OK.
I would like to ask you:
Is there a way how to switch (any parametr for msbuild) between Shared and Static MFC DLL?
msbuild .\my_project.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64 /p:ANYKEYWORD=Shared
msbuild .\my_project.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64 p:/ANYKEYWORD=Static
or anything like that.
I can not find a way, how to build project from command line and switch both possibilities: "Use MFC in a Shared DLL" and "Use MFC in a Static DLL" without opening IDE and switching it there manualy in project setting.
Thank you for advices and help.
Yes, It is a way, which is working well.
New configuration with config manager "StaticRelease" + change "Use Static DLL" from IDE.
Command line is then:
msbuild my_project.vcxproj /t:Rebuild /p:Configuration=ReleaseStatic /p:Platform=x64
Thank you again.
Last Visit: 31-Dec-99 18:00 Last Update: 4-Oct-23 1:30