(2 years later...)
Hi Doug!
On 11/13/22 23:39, Douglas McIlroy wrote:
> > Wouldn't it be nice to use -Wunterminated-strings and let the
> > compiler yell at me if I write a string literal [that's too long]?
>
> A good idea. Assuming you use gcc, please propose it at
> https://gcc.gnu.org/bugzilla
Hi Doug!
On 11/13/22 23:39, Douglas McIlroy wrote:
> Wouldn't it be nice to use -Wunterminated-strings and let the
compiler yell at me if I write a string literal [that's too long]?
A good idea.
Thanks!
Assuming you use gcc, please propose it at
https://gcc.gnu.org/bugzilla.
Yep I use
> Wouldn't it be nice to use -Wunterminated-strings and let the
> compiler yell at me if I write a string literal [that's too long]?
A good idea. Assuming you use gcc, please propose it at
https://gcc.gnu.org/bugzilla.
Apropos of help from the compiler, I normally run gcc via this script
and sta
On Sun, Nov 13, 2022 at 10:25:35PM +0100, Alejandro Colomar wrote:
> On 11/13/22 22:20, Alejandro Colomar wrote:
> >See for example some (part of a) change that I did for optimizing some
> >code, where I transformed pointers to char to char arrays (following
> >Ulrich Drepper's article about librar
BTW, just as a curiosity, I'm facing a code base full of unterminated strings,
and the good thing is it uses u_char* everywhere. So I'll do some small change
to make sure I know which strings are terminated by starting to use char* on
those. Then, the compiler will warn me if I mix them at any
Hi Larry!
On 11/13/22 21:45, Larry McVoy wrote:
> None of this surprises me but it reminds me of how I described C to
> my older son who is learning computer science.
>
> C is sort of like driving a sports car on a narrow mountain road with
> no guard rails. If you like to text while you drive,
Hi Ralph,
On 11/13/22 21:08, Ralph Corderoy wrote:
Hi Branden,
C doesn't _really_ have strings, except at the library level.
It has character arrays and one grain of syntactic sugar for encoding
"string literals", which should not have been called that because
whether they get the null termina
None of this surprises me but it reminds me of how I described C to
my older son who is learning computer science.
C is sort of like driving a sports car on a narrow mountain road with
no guard rails. If you like to text while you drive, C is not for you.
If you can't keep your eyes on the road,
Hi Branden,
> C doesn't _really_ have strings, except at the library level.
> It has character arrays and one grain of syntactic sugar for encoding
> "string literals", which should not have been called that because
> whether they get the null terminator is context-dependent.
>
> char a[5]