Re: armcc -zasn




<giribizzo@xxxxxxxx> wrote in message
news:1145461566.957420.182330@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,

I am using the -zasN armcc compiler option to set the alignment, but
the compiler (ADS 1.2) gives me a warning:

Warning: C2067I: option -zas will not be supported in future releases
of the compiler

How can I set the alignment in a non-deprecated way?

The first question you want to ask yourself is why you need to increase
structure alignment of all structures to a non-default setting? If you don't
have a good reason then using the default is best - the difference doesn't
matter in most cases.

You can control the alignment of a structure type using a bitfield of the
type you want to align to at the end. It can be zero sized, however it is
better to make padding bytes explicit using an anonymous bitfield.

You can control the alignments of objects by wrapping them in a union
containing a type with higher alignment or using the __align directive.

If you want lower the alignment, you have to use __packed instead.

Wilco


.



Relevant Pages

  • Re: problem with sizeof
    ... my compiler spits out a warning on the above ... I guess the problem is with alignment and padding of structs. ... Becasue of the change in expected sizes this line: ...
    (comp.lang.c)
  • Re: Isnt it time there was a standard align statement?
    ... C language actually allowed some portable control over data ... /* per member alignment (obviously padding before the first ... fatal with compiler specific switches - and that's no business of the ...
    (comp.lang.c)
  • Re: I am learning C: a little problem with a simple source code
    ... One can turn off particular warnings with this compiler, ... For each driver, if the size is unsupported, the driver can give up. ... Similarly, it'd be nice to pass a 'size_t' for the alignment, too. ...
    (comp.lang.c)
  • Re: How does C cope if architecture doesnt address bytes?
    ... >>which the malloc() call occurs, figure out the type of the pointer which ... alignment in the implementation, rather than in either part of it. ... compiler and library are so strictly separate that there is no ... # The pointer returned if the allocation succeeds is suitably aligned so ...
    (comp.lang.c)
  • Re: register attribute
    ... The point of dynamic data structures is that the mass of ... I recall the alignment problem being reported in Byte ... > the programmer will know but the compiler won't. ...
    (comp.lang.fortran)