Attached to this post, you can find a helper header for compile time assertions, partially based on John Payson's post, but fine tuned in order to work with some compilers I use (Borland C++, PICC, PICC-18). Hopefully it should work with another compilers.
I hope this header could be a nice solution to the problem that appeared in the 'sizeof' operator -- preprocessor vs. C thread.
Please read the comments in the header itself. Any comments will be welcomed.
[ To the forum moderator: I was not sure whether this is the best forum for posting this header, because it was designed to be used with any ANSI compiler, not just HI-TECH's. Maybe "General Programming"? ]
|