X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f Message-ID: <3C639073.4D12303@yahoo.com> From: CBFalconer Organization: Ched Research X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: Alignment problem References: <3C629769 DOT AEAFB611 AT cyberoptics DOT com> <3C62A89A DOT 9DF630C5 AT yahoo DOT com> <3C630FB1 DOT E69F87A AT cyberoptics DOT com> <3C63319A DOT 2E193983 AT yahoo DOT com> <7484-Fri08Feb2002094855+0200-eliz AT is DOT elta DOT co DOT il> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 32 Date: Fri, 08 Feb 2002 08:49:31 GMT NNTP-Posting-Host: 12.90.167.57 X-Complaints-To: abuse AT worldnet DOT att DOT net X-Trace: bgtnsc04-news.ops.worldnet.att.net 1013158171 12.90.167.57 (Fri, 08 Feb 2002 08:49:31 GMT) NNTP-Posting-Date: Fri, 08 Feb 2002 08:49:31 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: > > > From: CBFalconer > > ... snip ... > > > printf(" ptr %p is %2d-byte aligned. (int)p = %d6\n", > > So my conclusion is that pointers are 8-byte aligned both before and > after the cast, for the program you wrote. > > > 0x205d8 * 10 + 6 = 1325686, for example. > > What does this example supposed to show? Nothing in particular - it was just a recast of the OPs code. However I see that a totally extraneous 6 slipped into the format string, which explains everything. Of course you can do whatever you want on a cast to int. I'm not complaining about that. I'm just pointing out that it is undefined behaviour as far as the language is concerned. On many systems, including segmented DOS, that cast would make no sense whatsoever. So the test of the integer representation really says nothing about the alignment, except in particular implementations. -- Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT XXXXworldnet DOT att DOT net) Available for consulting/temporary embedded and systems. (Remove "XXXX" from reply address. yahoo works unmodified) mailto:uce AT ftc DOT gov (for spambots to harvest)