Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Preprocessor limitation workarounds
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Nick, post: 3982792"] I've given further thought, and given that you are limited in what you can run that understands the target architecture (essentially, limited to the compiler) I think you have to use the standard pre-processor. In that case, I think you might need to do something like this: Write a configuration program in whatever language you use that does all the calculations on your constants - so (FOO*(FOO-1)+2) as above. It should also read in an entire system of names for every plausible type in your target C dialects, in increasing size for each type and signedness. Then it can loop round and find the best size for the results of each evaluation, and spit out a small header file to be included. There's a bit of work in defining the names, but no more than you'll need to do in your current architecture specific header files, and you can probably use a much more reader-friendly syntax (reading it from a configuration file, probably). I can't see a better way. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Preprocessor limitation workarounds
Top