Return to the archive index

Re: Memory allocation questions

To: linux-8086@vger.rutgers.edu
Cc: linux-8086@vger.rutgers.edu
From: vern@zebra.alphacdc.com (vern)
Date: 	13 Jul 97 16:32:40 MDT (Sun)
Newsgroups: linux.dev.8086

Perry Harrington wrote:

>	/* now, the "sizeof" command is a compiler preprocessor usually,
>		it looks in it's symbol table for the size of the
>		data item and replaces the call with a constant, this
>		works because structs can't be declared at runtime.

My copy of ANSI C lists 'sizeof' as a C operator, not a preprocessor
operator.  The only operators used in the preprocessor are the 'defined',
'#' (stringify) and '##' (paste) operators.

Macro substitution does not even perform addition or subtraction of
constants.

#define ONE 1

printf( "%d", ONE + 1 );

results in:

printf( "%d", 1 + 1 );

to the compiler.

They specifically state that:

#define ZERO (1-1)

is not the same as:

#define ZERO (0)

vern

Vernon C. Hoxie                                           scicom!zebra!vern
3975 W. 29th Ave.                                   vern@zebra.alphacdc.com
Denver, Colo., 80212        uucp: 303-455-2670          voice: 303-477-1780
               Unix is what MSDOS will be when it grows up.

From Unofficial Linux-8086 Mailing List Archive (ULMLA)
Maintained by Robert
Robert's Mailing List Archive Page

Archive created with babymail