Mail Archives: djgpp/1997/10/26/19:17:12
mert0407 AT sable DOT ox DOT ac DOT uk (George Foot) wrote:
>#include <stdio.h>
>#define psize(a,b) printf ("Size of %s: %d\n",a,sizeof(b));
To respect the compulsory laziness of new programmers, make this macro
take only one parameter, like this:
#define psize(a) printf("Size of %s %d\n",#a,a);
int main(void) {
psize(char);
psize(short);
...
(I use such preprocessor tricks often when macro-fying common inline
assembler constructs... but it often requires some will to RTFM...
(which, btw, means Read The Forgotten Manual according to Usenet
documents I've "RTFM-ed"... the other meaning of the F is probably
common slang, which I do not prefer to use))
- Raw text -