[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Bizarre string problem
From: |
Richard Urwin |
Subject: |
Re: [avr-gcc-list] Bizarre string problem |
Date: |
Thu, 9 Sep 2004 20:25:38 +0100 |
User-agent: |
KMail/1.5.3 |
On Thursday 09 Sep 2004 1:22 pm, Joerg Wunsch wrote:
> Richard Urwin <address@hidden> wrote:
> >> char t[2] = "T";
> >
> > I don't remember that being standard C.
>
> It is. It's more commonly written as
>
> char t[] = "T";
Yes, I agree. It was the
char t[1]="T"
I was questioning, since "T" is inherently 2 bytes long.
It might be standard C, or it may only be allowed on some compilers. I
don't have a copy of K&R to check.
Whichever, using it should probably follow the two rules of
optimisation...
1. Don't do it.
2. (For experts only) Don't do it now.
...since having a C string that doesn't have a \0 terminator is likely
to cause confusion somewhere down the line.
--
Richard Urwin
Re: [avr-gcc-list] Bizarre string problem, Joerg Wunsch, 2004/09/09