Richard, "The best Fortran programs are written after you spill the box of cards; rewriting the code may be faster and better." Been there. Done that. Thanks for the chuckle. Dave --- In lpc2000@yahoogroups.com, "rtstofer" <rstofer@...> wrote: > > --- In lpc2000@yahoogroups.com, "dsidlauskas1" <dsidlauskas@> wrote: > > > > Jaya, > > > > Since the compiler knows that buf is a byte aligned object, woutldn't > > it be resonable for the compiler to treat > > > > (int *)&buf[i] > > > > as > > > > (__packed int *)&buf[i] > > > > In general, if non-naturaly aligned objects are promoted by a cast, > > shouldn't, by default, the cast be of the proper non-aligned type? > > > > BTW. Really appreciate your discussion of interupts on your web site. > > > > Dave > > > > I guess I don't see why the compiler should do anything. You asked it > to cast the ADDRESS of a byte in memory to an int * which is an > address (by definition) and put it in another int * which is also an > address. No problem... So far everything is just an address. > > Until you actually use the pointer to grab the contents of memory > there is no alignment issue. And, on the i386 there still wouldn't be > a problem because the i386 doesn't care about alignment, just > endianness. It is just a thing with the ARM (and others, I suppose) > that alignment is a concern. > > As to porting: well, it is likely that nearly every line of C code is > suspect as almost everything is being done with pointers or structures > or is hardware specific. Getting the program to work again will be > more of a challenge than simply rewriting it. How big could it be if > it originally ran on an 8 bit processor? Unless it is a full O/S like > CP/M and all of the utilities... > > The best Fortran programs are written after you spill the box of > cards; rewriting the code may be faster and better. > > Richard >
Message
Re: For C Experts
2006-03-31 by dsidlauskas1
Attachments
- No local attachments were found for this message.