From: dontmailme AT iname DOT com (Steamer) Newsgroups: comp.os.msdos.djgpp Subject: Re: Size_Of in DJGPP...Bug? Date: Mon, 05 Jun 2000 09:46:29 GMT Organization: always disorganized Lines: 26 Message-ID: <393b76f2.6576799@news.freeserve.net> References: NNTP-Posting-Host: modem-55.muellers-butterfly.dialup.pol.co.uk X-Trace: newsg1.svr.pol.co.uk 960198390 17602 62.136.217.55 (5 Jun 2000 09:46:30 GMT) NNTP-Posting-Date: 5 Jun 2000 09:46:30 GMT X-Complaints-To: abuse AT theplanet DOT net X-Newsreader: Forte Free Agent 1.11/32.235 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Radical NetSurfer wrote: > void main(void) { Make that: int main(void) { > // printf("The size_of a Enum is %ld\n", sizeof(enum)); [snip] > QUESTION: > Why is not proper to use 'enum' in Size_of ?? > Normally, this is defined as 2-Bytes (=to short or int), > but in DJGPP, its a SYNTAX error.... You can't do sizeof(enum) for the same reason that you can't do sizeof(struct) or sizeof(union). It just doesn't make sense. Try using sizeof on a particular enum and it will work. In DJGPP, the size will be 1, 2 or 4, depending on how many values the enum has and whether or not you compiled with -fshort-enums. By the way, your code also assumes that it's OK to print a size_t as if it were a long. This will work in DJGPP, but you should cast it to be safe (and use unsigned long rather than long). S.