They may be different under the hood and have subtly different meanings,
but both work in Linux GCC and AVR-GCC without the __flash qualifier.  I've
seen these statements used interchangeably in Linux C code, for instance.

The relevant question is, what is the behavior of __flash that causes one
to work when the other doesn't when compiling for AVR?

~James


On Sun, Jul 6, 2014 at 12:25 PM, Jim Wagner <wagneja...@comcast.net> wrote:

> Big Difference. The first defines an array of characters and initializes
> it with the string "Hello There". In doing so, it even determines the size
> of the array for you. Note:  there is one more character than you might
> expect because every C string ends with a null character that you don't see.
>
> The second does not even define a variable. A char just holds one
> character. But, you have not even specified a variable that the type char
> applies to.
>
> The two are totally different.
>
> Jim Wagner
> Oregon Research Electronics
>
> On Jul 6, 2014, at 9:00 AM, avr-gcc-list-requ...@nongnu.org wrote:
>
> > Date: Sun, 6 Jul 2014 18:33:40 +0530
> > From: Royce Pereira <royc...@gmail.com>
> > To: "avr-gcc-list@nongnu.org" <avr-gcc-list@nongnu.org>
> > Subject: [avr-gcc-list] String declaration query

> Hi,
> >
> > What is the differenence between:
> >
> > __flash const char myString[] = "Hello There!" ;
> >
> > and
> >
> > __flash const char *myString = "Hello There!" ;
> >
> > AFAIK, both should be same, but the 2nd gives the error:
> >
> > " ... initializer element is not computable at load time"
> >
> > Am I writing it wrong ?
> >
> > Thanks.
> > --
> > Best Regards,
> >
> > -- Royce Pereira
> >
>
_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to