[Bug 269] Many compiler warnings with gcc 4.0
Paul TBBle Hampson
Paul.Hampson at Pobox.com
Wed Aug 31 08:47:16 CEST 2005
On Tue, Aug 30, 2005 at 01:15:45PM -0700, Steven Simon wrote:
> I tend to think this is the wrong approach. By convention, C strings are
> signed and Pascal strings (I know, nobody uses them anymore) are unsigned.
> If char defaults to unsigned, it could cause more problems than it solves.
> We want the compiler to tell us if we're mixing C- strings and data buffers.
> I agree with the other list members who don't like the casts. My question
> is, why is the strvalue field unsigned? Does it ever contain data that's not
> a C-string?
Chars are unsigned on Linux PowerPC. I don't believe there's anything that
depends on chars being signed that doesn't explicitly declare such, as I ran
FreeRADIUS on LinuxPPC without issues for a few years. I think all
signed-char assumptions were therefore shaken out a fair while ago.
So we could add -funsigned-char to CFLAGS and see what happens... ^_^
I thought gcc4 was moving to unsigned-char by default, but I guess not...
(C-strings are null-terminated. Pascal strings start with their length. ^_^)
What's actually happening here is not that we're confusing data buffers and
strings, but that we're using string functions (which actually operate on
null-terminated data buffers) on null-terminated data buffers. So if anyone's
confusing the two, it's glibc. ^_^
--
-----------------------------------------------------------
Paul "TBBle" Hampson, MCSE
8th year CompSci/Asian Studies student, ANU
The Boss, Bubblesworth Pty Ltd (ABN: 51 095 284 361)
Paul.Hampson at Pobox.Com
Of course Pacman didn't influence us as kids. If it did,
we'd be running around in darkened rooms, popping pills and
listening to repetitive music.
-- Kristian Wilson, Nintendo, Inc, 1989
License: http://creativecommons.org/licenses/by/2.1/au/
-----------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.freeradius.org/pipermail/freeradius-devel/attachments/20050831/5196246d/attachment.pgp>
More information about the Freeradius-Devel
mailing list