stdlib.h includes sys/types.h which itself includes sys/inttypes.h
I guess it has been moved there along with other relocations of include files 
in the linux/gcc world.
And it makes some sense. the definitions of the various INT types are system 
specific (this is why you need this file at all). The main include folder 
should only contain include files which are identical for all systems.
Of course it makes not too much sense if the whole system setup is focused on 
only one target (the MSP430). And all the msp430x.h files are misplaced too.

JMGross

p.s.: you can use '1L' instead of '(int32_t)1' in case of long constants.

----- Ursprüngliche Nachricht -----
Von: Rick Jenkins
An: [email protected]
Gesendet am: 09 Nov 2009 18:52:52
Betreff: Re: [Mspgcc-users] Bug in warnings

On Monday 09 November 2009 10:28  Chris Liechti wrote:
> Why is that a bug? your numbers are ints it does an int calculation an
> then extends the result to store it/ return it (the rules when C does
> implicit casts are not always intuitive :/ )

My apologies, you are of course correct. In fact, best practice would be:

#include <sys/inttypes.h>
static int32_t bugfree(void)
{
  int32_t debugged;

  debugged = (int32_t)1 << 30;
  return( debugged );
}

This is almost portable, but for the fact that inttypes.h is in sys on 
msp430gcc. Is there any compelling reason for this?


Reply via email to