X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "Rod Pemberton" Newsgroups: comp.os.msdos.djgpp Subject: Re: Upgrading from a bad C compiler Date: Sun, 22 Jul 2012 11:50:15 -0400 Organization: Aioe.org NNTP Server Lines: 53 Message-ID: References: <17d4b525-2c31-4c20-b3c5-a7118343e9a5 AT googlegroups DOT com> NNTP-Posting-Host: CNsg4fVcCsvs3UaOgZtQCw.user.speranza.aioe.org X-Complaints-To: abuse AT aioe DOT org X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.2001 X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: Microsoft Outlook Express 6.00.2800.2001 X-Priority: 3 X-MSMail-Priority: Normal Bytes: 3017 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com wrote in message news:b1f8c389-45f4-43e4-9056-62fc50fc9462 AT googlegroups DOT com... > On Friday, July 20, 2012 6:20:19 PM UTC-5, Rod Pemberton wrote: ... > > It's \\ not // for C++ comments... > > It's not \\ but indeed // for C99 and C++. Granted, some languages > might allow this. I know you like Forth, [...] > Sorry, you and the OP are correct. C's are both the same direction. Too much Forth lately, I guess... C uses // for full line comments and /* ... */ for delimited comments. Forth uses \ for full line comments and ( ... ) for delimited comments. I do the same if I'm using NASM alot too, i.e., attempt to use "%if" instead of "#if" etc for C. > I think you woke up on the wrong side of the bed. :-) Actually, it was "late" for me when I wrote it, but I did reread it when I woke, just prior to posting. So, I missed it, not once, but twice ... > Actually, on another note, I'm now vaguely curious about > sizeof(struct) and how alignment (esp. C11 stdalign crud > or whatever) would affect that. I'd assume alignment would increase the physical size. I don't know if it increases sizeof()'s value though. I would think not... I would think that C should only return the total size for C elements and not padding or alignment. I can consult a book if you want. I generally try to avoid using sizeof(). However, it's sometimes convenient to get the size for procedures like malloc(), fread(), memset(). Sometimes they'll be passed values or buffers whose size is unknown at compile time, e.g., malloc(). For most situations, padding or alignment doesn't matter. You're accessing the struct's C elements. You don't need to access padding. So, if there is space inbetween, it's unimportant. However, if the struct needs to be without padding or a specific alignment, you can pack it. Most C compilers have an extension, or sometimes few, to allow packing and aligning structs. > http://en.wikipedia.org/wiki/Sizeof > I should probably read that, and the book's section too. Although, I won't unless pressed. :-) Rod Pemberton