Res: [c-prog] Re: integer promotions

2008-11-30 Thread Pedro Izecksohn
--- peternilsson42 wrote: Maybe you need -Wsign-conversion gcc -Wall -Wsign-conversion problem.c -o problem cc1: error: unrecognized command line option -Wsign-conversion Time you updated then... % gcc --version gcc.exe (GCC) 4.3.2 Thank you.

Re: Res: [c-prog] Re: integer promotions

2008-11-28 Thread David Hamill
It's never a good idea to be running as root... To unsubscribe, send a blank message to mailto:[EMAIL PROTECTED].Yahoo! Groups Links

Res: [c-prog] Re: integer promotions

2008-11-28 Thread peternilsson42
Pedro Izecksohn [EMAIL PROTECTED] wrote: --- peternilsson42 wrote: -Wconversion Warn for implicit conversions that may alter a value. ... Integral promotions don't alter the value. Maybe you need -Wsign-conversion gcc -Wall -Wsign-conversion problem.c -o problem cc1: error:

Re: Res: [c-prog] Re: integer promotions

2008-11-27 Thread Pedro Izecksohn
--- peternilsson42 wrote: -Wconversion Warn for implicit conversions that may alter a value. ... Integral promotions don't alter the value. Maybe you need -Wsign-conversion gcc -Wall -Wsign-conversion problem.c -o problem cc1: error: unrecognized command line option

Re: Res: [c-prog] Re: integer promotions

2008-11-27 Thread Pedro Izecksohn
--- Thomas Hruska wrote: Try compiling your code as C++ and see if there is a difference. C++ compilers tend to generate a lot more warnings as the language is, generally-speaking, more strict. [EMAIL PROTECTED] ~/programming/c++/problem $ ls -la total 10 drwxr-xr-x+ 2 root None 4096 Nov

Re: Res: [c-prog] Re: integer promotions

2008-11-27 Thread andrew clarke
On Thu 2008-11-27 16:50:55 UTC-0800, Pedro Izecksohn ([EMAIL PROTECTED]) wrote: [EMAIL PROTECTED] ~/programming/c++/problem $ ls -la total 10 drwxr-xr-x+ 2 root None 4096 Nov 27 22:47 . drwxr-xr-x+ 11 root None 4096 Nov 27 22:35 .. -rw-r--r-- 1 root None 69 Nov 27 22:37 Makefile It's

Res: [c-prog] Re: integer promotions

2008-11-25 Thread Pedro Izecksohn
--- peternilsson42 wrote: So you made absolutely _no_ change to the semantics of that assignment! I fixed the signal to make others happy. You seem to be only interested in one class of machine. why do you think that? Or, do you think different values should be displayed? My previous

Res: Res: [c-prog] Re: integer promotions

2008-11-25 Thread Pedro Izecksohn
--- I wrote: It is mathematically obvious the Intel's approach. I thought it applied wherever it is possible. Correction: I thought the mathematically obvious approach would be applied wherever possible.

Res: [c-prog] Re: integer promotions

2008-11-25 Thread peternilsson42
Pedro Izecksohn [EMAIL PROTECTED] wrote: peternilsson42 wrote: [ unsigned short int a; a = USHRT_MAX; /* previously a = -1; */] So you made absolutely _no_ change to the semantics of that assignment! I fixed the signal to make others happy. You must be referring to Thomas'

Res: Res: [c-prog] Re: integer promotions

2008-11-25 Thread Pedro Izecksohn
--- peternilsson42 wrote: Ah, then you've probably been fooled by the cliché that C is just portable assembler. If I could do just one modification to the standard, I'd add an overflow macro, like errno.

Res: Res: [c-prog] Re: integer promotions

2008-11-25 Thread peternilsson42
Pedro Izecksohn [EMAIL PROTECTED] wrote: --- peternilsson42 wrote: Ah, then you've probably been fooled by the cliché that C is just portable assembler. If I could do just one modification to the standard, I'd add an overflow macro, like errno. The behaviour on integer overflow is

Res: Res: Res: [c-prog] Re: integer promotions

2008-11-25 Thread Pedro Izecksohn
--- I wrote: If I could do just one modification to the standard, I'd add an overflow macro, like errno. --- peternilsson42 replied: The behaviour on integer overflow is undefined. Hence, implementations already have the freedom to do precisely that if they so choose. [That they don't is

Re: Res: [c-prog] Re: integer promotions

2008-11-25 Thread Thomas Hruska
peternilsson42 wrote: Pedro Izecksohn [EMAIL PROTECTED] wrote: peternilsson42 wrote: [ unsigned short int a; a = USHRT_MAX; /* previously a = -1; */] So you made absolutely _no_ change to the semantics of that assignment! I fixed the signal to make others happy. You must

Re: Res: [c-prog] Re: integer promotions

2008-11-25 Thread Pedro Izecksohn
--- Thomas Hruska wrote: There would also have been warnings on the next line of code with the compiler complaining about a signed to unsigned conversion or something like that. That would have been the more useful clue to the OP that a weird conversion was happening behind the scenes.

Re: Res: [c-prog] Re: integer promotions

2008-11-25 Thread Thomas Hruska
Pedro Izecksohn wrote: --- Thomas Hruska wrote: There would also have been warnings on the next line of code with the compiler complaining about a signed to unsigned conversion or something like that. That would have been the more useful clue to the OP that a weird conversion was

Res: [c-prog] Re: integer promotions

2008-11-25 Thread peternilsson42
Pedro Izecksohn [EMAIL PROTECTED] wrote: --- Thomas Hruska wrote: peternilsson42 wrote: Pedro Izecksohn [EMAIL PROTECTED] wrote: peternilsson42 wrote: [ unsigned short int a; a = USHRT_MAX; /* previously a = -1; */ ] So you made absolutely _no_ change to the semantics of

Res: [c-prog] Re: integer promotions

2008-11-23 Thread Pedro Izecksohn
--- Thomas Hruska wrote: BTW, you should have your compiler warnings turned up so that you get a warning for assigning a signed value to an unsigned variable. --- John Matthews asked: And anyone know the gcc equivalent? Gcc's -Wall 'all warnings' option doesn't include it. --- andrew