Rockbox mail archiveSubject: Re: file read/write code
Re: file read/write code
From: Linus Nielsen Feltzing <linus_at_haxx.se>
Date: Fri, 08 Nov 2002 20:40:31 +0100
Greg Haerr wrote:
> I can agree with that. The principles I've used over the years
> for declarations are twofold: 1) try to be accurate but simple,
> 2) use a type that helps the reader understand what's going on.
> For instance, for me:
> "int" means basically an integer, it doesn't matter what the storage size is.
> "long", "short", "char" - the storage size is declared explicitly, it
> matters what the storage size is.
Very much like my principles too, actually. :-)
> For the FAT32 filesystem, we have to use 32-bit storage locations
> or the algorithm as coded won't work. It can't be 16 bits or 64 bits for
> the current code to run.
Correct. But it may very well fail when porting to a 64-bit architecture
with sizeof(long)==8. On most 32-bit platforms, int is 32 bits and long
int as well. But on 64-bit platforms (the Itanium for example) long may
be 64 bits and int 32 bits.
Using long will only work if you try to port to a lesser architecture.
Received on 2002-11-08