Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #35020

Re: Baby X

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c
Subject Re: Baby X
Date 2013-08-07 07:19 +1200
Message-ID <b6d0h4Fjh4dU6@mid.individual.net> (permalink)
References (3 earlier) <60109729-9f4c-4ed8-97fb-4a0a4247c3b1@googlegroups.com> <lnli4huolk.fsf@nuthaus.mib.org> <2cc97c3d-2f47-4276-a2dc-9aa0d68ccea3@googlegroups.com> <b6ag1rFgv3dU1@mid.individual.net> <057d1432-3b2d-4112-ab81-447c291a5557@googlegroups.com>

Show all headers | View raw


Malcolm McLean wrote:
> On Monday, August 5, 2013 9:25:31 PM UTC+1, Ian Collins wrote:
>> Malcolm McLean wrote:
>>
>>> Signed types are safer for size calculations because they
>>> can trap if the size overflows.
>>
>> Tell that to the designers of the standard library (and X).
>>
> Unfortunately, a reasonably intelligent programmer can think that "this
> quantity cannot be negative, therefore it ought to be unsigned". He's almost
> always wrong. For instance pixel indices can't be negative when drawing, so
> draw_pixel() can take unsigned x, y. But in fact most calling code is going to
> generate intermediate values which can be negative, so it's a nuisance. This
> example is too obvious for most people to fall into the trap. It's valid to
> subtract one depth from another to yield a depth difference, so depth should
> be signed. It's a little glitch on X, but we have to live with it. We can't
> change the interface now.

No, you can't.  So pass the correct types.

> size_t is a disaster for the C language, and I've spoken against it on many
> occasions. I won't rehash the arguments here.

It's also irrelevant to this discussion.

> But gcc doesn't give a warning by default.

gcc isn't a conforming compiler by default.

>>> But I'll certainly look and see what can be suppressed.
>>
>> Just fix, there's no need to suppress valid warnings.
>>
> Whilst the code compiles cleanly if compiled according to the instructions,
> I agree there's a case for supporting a clean compile under stricter warnings,
> so that people can choose to use them if they find them useful. The warnings
> aren't valid, however, and the code is correct. They're noise.

The warnings are valid and will be generated by any conforming compiler, 
which makes you code at best annoying and at worse useless to anyone 
using a decent compiler.

-- 
Ian Collins

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-03 16:40 -0700
  Re: Baby X Jorgen Grahn <grahn+nntp@snipabacken.se> - 2013-08-04 06:04 +0000
    Re: Baby X "BartC" <bc@freeuk.com> - 2013-08-04 10:29 +0100
      Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-04 02:53 -0700
        Re: Baby X Keith Thompson <kst-u@mib.org> - 2013-08-04 14:34 -0700
          Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-05 04:36 -0700
            Re: Baby X Keith Thompson <kst-u@mib.org> - 2013-08-05 08:04 -0700
            Re: Baby X Ian Collins <ian-news@hotmail.com> - 2013-08-06 08:25 +1200
              Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-06 04:38 -0700
                Re: Baby X Ian Collins <ian-news@hotmail.com> - 2013-08-07 07:19 +1200
                Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-06 12:38 -0700
                Re: Baby X Ian Collins <ian-news@hotmail.com> - 2013-08-07 07:49 +1200
                Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-06 15:17 -0700
                Re: Baby X Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-08-07 00:29 +0100
                Re: Baby X Ian Collins <ian-news@hotmail.com> - 2013-08-07 13:45 +1200
                Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-07 03:22 -0700
                Re: Baby X James Kuyper <jameskuyper@verizon.net> - 2013-08-07 06:36 -0400
                Re: Baby X Dr Nick <nospam-4@temporary-address.org.uk> - 2013-08-10 20:04 +0100
                Re: Baby X Kelsey Bjarnason <kbjarnason@gmail.com> - 2013-08-09 17:28 +0000
                Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-09 12:43 -0700
                Re: Baby X glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-08-09 20:01 +0000
                [OT] Re: Baby X Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-08-09 16:30 -0400
                Re: Baby X Keith Thompson <kst-u@mib.org> - 2013-08-09 14:12 -0700
                Re: Baby X Dr Nick <nospam-4@temporary-address.org.uk> - 2013-08-10 20:11 +0100
                Re: Baby X Robert Wessel <robertwessel2@yahoo.com> - 2013-08-10 14:41 -0500
                Re: Baby X James Kuyper <jameskuyper@verizon.net> - 2013-08-10 21:34 -0400
                Re: Baby X Dr Nick <nospam-4@temporary-address.org.uk> - 2013-08-11 11:02 +0100
                Re: Baby X James Kuyper <jameskuyper@verizon.net> - 2013-08-11 12:54 -0400
                Re: Baby X Richard Damon <Richard@Damon-Family.org> - 2013-08-11 13:51 -0400
                Re: Baby X James Kuyper <jameskuyper@verizon.net> - 2013-08-11 14:10 -0400
                Re: Baby X Richard Damon <Richard@Damon-Family.org> - 2013-08-11 14:43 -0400
                Re: Baby X Keith Thompson <kst-u@mib.org> - 2013-08-11 14:03 -0700
                Re: Baby X Richard Damon <Richard@Damon-Family.org> - 2013-08-11 17:57 -0400
                Re: Baby X Keith Thompson <kst-u@mib.org> - 2013-08-11 18:37 -0700
                Re: Baby X glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-08-12 04:12 +0000
                Re: Baby X Dr Nick <nospam-4@temporary-address.org.uk> - 2013-08-12 07:42 +0100
                Re: Baby X Keith Thompson <kst-u@mib.org> - 2013-08-12 09:10 -0700
                Re: Baby X Philip Lantz <prl@canterey.us> - 2013-08-17 22:31 -0700
                Re: Baby X James Kuyper <jameskuyper@verizon.net> - 2013-08-18 14:50 -0400
                Re: Baby X Ike Naar <ike@iceland.freeshell.org> - 2013-08-18 20:15 +0000
                Re: Baby X James Kuyper <jameskuyper@verizon.net> - 2013-08-18 16:30 -0400
                Re: Baby X Ike Naar <ike@iceland.freeshell.org> - 2013-08-18 21:03 +0000
                Re: Baby X Ian Collins <ian-news@hotmail.com> - 2013-08-20 13:09 +1200
                Re: Baby X Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2013-08-20 12:24 +0300
                Re: Baby X Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-08-20 13:11 +0100
                Re: Baby X Keith Thompson <kst-u@mib.org> - 2013-08-20 08:33 -0700
                Re: Baby X Ian Collins <ian-news@hotmail.com> - 2013-08-21 08:01 +1200
                Re: Baby X Keith Thompson <kst-u@mib.org> - 2013-08-11 13:57 -0700
                Re: Baby X James Kuyper <jameskuyper@verizon.net> - 2013-08-10 21:29 -0400
                Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-10 22:04 -0700
                Re: Baby X Ike Naar <ike@iceland.freeshell.org> - 2013-08-09 20:16 +0000
                Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-09 15:29 -0700
                Re: Baby X Ike Naar <ike@iceland.freeshell.org> - 2013-08-10 05:45 +0000
                Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-10 03:18 -0700
                Re: Baby X Ike Naar <ike@iceland.freeshell.org> - 2013-08-10 17:02 +0000
                Re: Baby X Ike Naar <ike@ukato.freeshell.org> - 2013-08-06 21:00 +0000
                Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-06 15:07 -0700
        Re: Baby X Ian Collins <ian-news@hotmail.com> - 2013-08-05 09:42 +1200
      Re: Baby X Roberto Waltman <usenet@rwaltman.com> - 2013-08-04 14:46 -0400
    Re: Baby X falk@rahul.net (Edward A. Falk) - 2013-08-15 03:02 +0000
      Re: Baby X falk@rahul.net (Edward A. Falk) - 2013-08-15 03:23 +0000
        Re: Baby X Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-15 06:09 -0700

csiph-web