This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/16458] endian.h macros return integers of wrong type


https://sourceware.org/bugzilla/show_bug.cgi?id=16458

Ondrej Bilka <neleai at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |INVALID

--- Comment #3 from Ondrej Bilka <neleai at seznam dot cz> ---
> The manpage also explicitly says these are functions, not macros. And if these 
> were functions, they would in fact return values of the correct type, 
> regardless of the argument and parameter type, which is what the developer 
> expects in C. The only constraint being that "each argument shall have a type 
> such that its value may be assigned to an object with the unqualified version 
> of the type of its corresponding parameter" (i.e. ISO/IEC 9899:1999 6.5.2.2 
> Function calls

You are wrong here, A example that you supplied is invalid and you get same
warning with ordinary functions. Closing.

#include <stdint.h>

uint64_t foo(uint64_t bar)
{
  return bar;
}

int main() {
  const long int i = 42;
  const uint64_t b = foo(i);
  return (int) b;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]