On Tuesday 01 January 2002 02:19 pm, Josh Wilmes wrote: > This silences these warnings: > > test_main.c: In function `main': > test_main.c:165: warning: passing arg 6 of `mmap' with different width due > to p rototype > > pdump.c: In function `main': > pdump.c:55: warning: passing arg 2 of `mmap' as unsigned due to prototype > pdump.c:55: warning: passing arg 6 of `mmap' with different width due to > protot ype > > I'm not sure why the off_t cast was needed though.
Many modern compilers add typedeffed types to their intrisic list for type comparisons. It's used to be that they were more or less aliases, so the same base type typedeffed as two different types would always be treated the same as the compiler. Now, they tend to compare them all as if they were all base types, so that foo_t and bar_t aren't the same, even if they really are. (The same extends to checks with int and long, even if they've the same characteristics.) In your above case, it's hard to tell which, because it looks like the value passed in wasn't the same characteristic of the arg it was expecting. An un-suffixed numeral is an int - not an off_t, and probably not even what the off_t really is. (The signed and width are potential problem spots with value truncation and sign interpretation. The compiler is simply bringing it to your attention.) By explicitly casting, you're effectively saying, I *give* you permisson to screw things up. -- Bryan C. Warnock [EMAIL PROTECTED]