Maarten:
> On 09-11-12 01:58, Jacob wrote:
>
> > And, BTW, pay attention to the "format %i expects type int" type of
> > warnings. Using the wrong or omitting required length modifiers can lead
> > to segfaults, too. Even if '%d' and '%ld' refer to integers of the same
> > size on an i386 platform, on a 64 bit platform they won't and weird
> > things can happen if the argument doesn't match the format spec.
> >
> > Jacob
>
>
> Yeah, that explains why I didn't get any compiling error on a 32bit
> computer and did get on a 64bit one (where I did correct the error).
> However, the latter was satisfied with %li. Apparently in c++ there is
> no difference between long and long int (as far as I can find through
> Google)
> but for c I could not find much info on a potential difference.
If you look in the c standard or one of its drafts, e.g. this one:
http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf
In (pdf)page 111 (written page 99) you'll find:
[qoute]
6.7.2 Type specifiers
...
2 At least one type specifier shall be given in the declaration specifiers in each declaration,
and in the specifier-qualifier list in each struct declaration and type name. Each list of
type specifiers shall be one of the following sets (delimited by commas, when there is
more than one set on a line); the type specifiers may occur in any order, possibly
intermixed with the other declaration specifiers.
-- void
-- char
-- signed char
-- unsigned char
-- short, signed short, short int, or signed short int
-- unsigned short, or unsigned short int
-- int, signed, or signed int
[newpage]
-- unsigned, or unsigned int
-- long, signed long, long int, or signed long int
-- unsigned long, or unsigned long int
-- long long, signed long long, long long int, or
signed long long int
-- unsigned long long, or unsigned long long int
-- float
-- double
-- long double
-- _Bool
-- float _Complex
-- double _Complex
-- long double _Complex
-- struct or union specifier
-- enum specifier
-- typedef name
...
5 Each of the comma-separated sets designates the same type, except that for bit-fields, it is
implementation-defined whether the specifier int designates the same type as signed
int or the same type as unsigned int.
[end qoute]
I.e. "long" and "long int" designates the same type.
Regards,
/Karl Hammar
-----------------------------------------------------------------------
Aspö Data
Lilla Aspö 148
S-742 94 Östhammar
Sweden
+46 173 140 57
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Fri Nov 9 20:15:02 2012
This archive was generated by hypermail 2.1.8 : Fri Nov 09 2012 - 20:15:02 EET