[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PIPE_BUF and read with SIZE < 0
From: |
Robert Millan |
Subject: |
Re: PIPE_BUF and read with SIZE < 0 |
Date: |
Fri, 25 Apr 2003 12:26:01 +0200 |
User-agent: |
Mutt/1.5.4i |
On Wed, Apr 23, 2003 at 05:50:49PM -0400, James A. Morrison wrote:
> On Wed, 2003-04-23 at 16:20, Robert Millan wrote:
> > - is the behaviour of read() undefined when the SIZE argument is a
> > negative value?
>
> [...]
> So, it can return a negative value, but size_t is, at least on
> GNU systems, unsigned. So specifing -1 will give you a rather large
> value, perhaps even 2^32 - 1.
I don't understand that. If size_t is an unsigned int, and i try to pass it
a signed int, shouldn't the compiler require a cast? so that "(size_t) -1"
should bring 2^32-1 and "-1" should fail to compile?
sign conversions like that are dangerous, maybe i should file a wishlist
bug on gcc?
--
Robert Millan
make: *** No rule to make target `war'. Stop.
Another world is possible - Just say no to genocide