Path: utzoo!attcan!uunet!husc6!rutgers!mailrus!ncar!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: hardcoded constants Message-ID: <15145@mimsy.UUCP> Date: 22 Dec 88 21:42:50 GMT References: <2636@m2-net.UUCP> <1104@goofy.megatest.UUCP> <267@twwells.uucp> <410@aplcen.apl.jhu.edu> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 14 >>sizeof('\0') is equal to the size of an integer .... >>Remember, in C, character constants are integer constants. In article <410@aplcen.apl.jhu.edu> arrom@aplcen.apl.jhu.edu (Ken Arromdee) writes: >I was under the impression that "sizeof" is done at compile time and isn't >really a function, so this would correctly return 1. sizeof is indeed not a function, yet sizeof('\0') is the same as sizeof(0) and sizeof(int), which are usually not the same as sizeof(char). The second `>>' line above is the key: the type of '\0' is int, not char. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris