Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: size of |
| Date | 2013-08-16 17:42 -0400 |
| Organization | Self |
| Message-ID | <520E9CA9.3090708@verizon.net> (permalink) |
| References | (4 earlier) <187064a6-873a-4fc5-9793-4bad74f1a3b6@googlegroups.com> <kugoq0$9uc$1@dont-email.me> <749dffa6-9bc8-4266-a087-8a5f08c1212a@googlegroups.com> <kuligf$odv$1@dont-email.me> <9e9788fd-f433-4190-9cdf-cd77de48ce95@googlegroups.com> |
On 08/16/2013 05:36 PM, Malcolm McLean wrote:
> On Friday, August 16, 2013 5:03:28 PM UTC+1, Kelsey Bjarnason wrote:
>> On Thu, 15 Aug 2013 08:54:53 -0700, Malcolm McLean wrote:
>>
>>> So size_t imagesize;
>>> size_t rasterbytes;
>>> size_t i;
>>
>>
>>> loadimage( ..., &imagesize);
>>> rasterbytes = imagesize - sizeof(ImageHeader);
>>
>>> for(i=0;i<rasterbytes;i++)
>>> printf("rasterbyte %z is %02x\n", i, image[sizeof(ImageHeader) + i]);
>>
>>> All reasonable?
>>
>>
>> Well, let's see. No idea what "loadimage" does, say, in cases of failure
>> or where the image is in fact larger than the capacity of a size_t to
>> represent (16-bit implementations, multi-gig images?).
>>
> Well if imagesize is a positive integer, and the function is correctly
> written, then you can assume that an object of that size has been successfully
> loaded into memory.
> I agree that use of a size_t makes it difficult to distinguish the error
> case from the empty case. Some OSs do allow files of length zero.
>>
>> Okay, so, it looks to me like poor error handling plus poor evaluation of
>> loop indexes. What has that got to do with some bizarre argument about
>> not using size_t for sizes?
>>
> What happens if we use an int instead?
With proper validity checks inserted? Pretty much the same thing that
happens if you use size_t, except that it cannot be used with images
larger than INT_MAX.
> If this was real code, what environment would you expect to see it in?
There's not enough details to be sure; but there's a pretty good chance
that it's one where INT_MAX wouldn't be big enough.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar
size of Raj Pashwar <raj121190@hotmail.NOSPAM.com> - 2013-08-13 18:43 +0000
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-13 13:46 -0500
Re: size of Raj Pashwar <raj121190@hotmail.NOSPAM.com> - 2013-08-16 22:06 +0000
Re: size of Azazel <azazel@remove.azazel.net> - 2013-08-16 17:32 -0500
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-16 18:10 -0500
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-16 17:11 -0700
Re: size of Raj Pashwar <raj121190@hotmail.NOSPAM.com> - 2013-08-17 09:11 +0000
Re: size of Shao Miller <sha0.miller@gmail.com> - 2013-08-17 05:38 -0400
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-17 09:00 -0400
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-16 21:43 -0400
Re: size of Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-08-16 22:36 -0400
Re: size of Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-17 03:08 -0700
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-17 08:57 -0400
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-17 13:35 -0700
Re: size of Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-17 15:17 -0700
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-17 17:06 -0700
Re: size of Richard Damon <Richard@Damon-Family.org> - 2013-08-17 18:27 -0400
Re: size of Tim Rentsch <txr@alumni.caltech.edu> - 2013-08-21 00:29 -0700
Re: size of Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-21 02:03 -0700
Re: size of Tim Rentsch <txr@alumni.caltech.edu> - 2013-08-23 10:27 -0700
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-23 10:38 -0700
Re: size of Tim Rentsch <txr@alumni.caltech.edu> - 2013-08-24 17:25 -0700
Re: size of gazelle@shell.xmission.com (Kenny McCormack) - 2013-08-21 16:05 +0000
Re: size of Tim Rentsch <txr@alumni.caltech.edu> - 2013-08-23 10:26 -0700
Re: size of Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2013-08-21 12:20 -0600
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-13 11:50 -0700
Re: size of Ike Naar <ike@iceland.freeshell.org> - 2013-08-13 21:52 +0000
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-13 15:49 -0700
Re: size of Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-14 08:22 -0700
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-14 10:38 -0700
Re: size of Kelsey Bjarnason <kbjarnason@gmail.com> - 2013-08-14 20:20 +0000
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-14 14:57 -0700
Re: size of Ken Brody <kenbrody@spamcop.net> - 2013-08-15 10:14 -0400
Re: size of Azazel <azazel@remove.azazel.net> - 2013-08-15 10:11 -0500
Re: size of Ken Brody <kenbrody@spamcop.net> - 2013-08-16 13:13 -0400
Re: size of Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-15 08:54 -0700
Re: size of Kelsey Bjarnason <kbjarnason@gmail.com> - 2013-08-16 16:03 +0000
Re: size of Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-16 14:36 -0700
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-16 17:42 -0400
Re: size of Kelsey Bjarnason <kbjarnason@gmail.com> - 2013-08-17 04:50 +0000
Re: size of Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-17 03:21 -0700
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-17 09:33 -0500
Re: size of Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-17 07:58 -0700
Re: size of Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-08-17 20:17 +0100
Re: size of Rosario1903 <Rosario@invalid.invalid> - 2013-08-18 09:22 +0200
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-19 20:42 -0500
Re: size of Rosario1903 <Rosario@invalid.invalid> - 2013-08-20 09:03 +0200
Re: size of Rosario1903 <Rosario@invalid.invalid> - 2013-08-20 09:06 +0200
Re: size of Ian Collins <ian-news@hotmail.com> - 2013-08-20 20:49 +1200
Re: size of Rosario1903 <Rosario@invalid.invalid> - 2013-08-20 10:57 +0200
Re: size of Rosario1903 <Rosario@invalid.invalid> - 2013-08-20 12:40 +0200
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-20 07:58 -0500
Re: size of Rosario1903 <Rosario@invalid.invalid> - 2013-08-20 18:27 +0200
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-20 12:27 -0500
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-20 12:20 -0700
Re: size of Ike Naar <ike@iceland.freeshell.org> - 2013-08-20 21:02 +0000
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-20 16:10 -0700
Re: size of Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2013-08-23 10:50 +0300
Re: size of Rosario1903 <Rosario@invalid.invalid> - 2013-08-21 07:39 +0200
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-22 13:15 -0500
Re: size of Barry Schwarz <schwarzb@dqel.com> - 2013-08-20 15:17 -0700
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-20 16:18 -0700
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-20 20:47 -0500
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-20 23:31 -0400
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-20 23:38 -0500
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-21 07:01 -0400
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-22 21:54 -0500
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-23 00:26 -0400
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-24 04:45 -0500
Re: size of Richard Damon <Richard@Damon-Family.org> - 2013-08-24 08:55 -0400
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-24 11:54 -0500
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-24 13:27 -0400
Re: size of Robert Wessel <robertwessel2@yahoo.com> - 2013-08-24 14:12 -0500
Re: size of Richard Damon <Richard@Damon-Family.org> - 2013-08-24 18:01 -0400
Re: size of glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-08-26 01:46 +0000
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-24 13:23 -0400
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-24 14:33 -0500
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-24 22:47 -0400
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-25 04:34 -0500
Re: size of glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-08-26 01:49 +0000
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-21 09:04 -0700
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-20 23:07 -0700
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-21 07:06 -0400
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-21 09:06 -0700
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-20 23:03 -0700
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-22 13:34 -0500
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-22 15:06 -0400
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-22 14:42 -0500
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-22 12:40 -0700
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-22 14:57 -0700
Re: size of Robert Wessel <robertwessel2@yahoo.com> - 2013-08-22 20:30 -0500
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-22 22:24 -0400
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-22 21:42 -0500
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-23 00:10 -0400
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-22 21:36 -0500
Re: size of Tim Rentsch <txr@alumni.caltech.edu> - 2013-08-24 14:53 -0700
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-22 23:30 -0700
Re: size of Tim Rentsch <txr@alumni.caltech.edu> - 2013-08-24 10:48 -0700
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-24 14:23 -0500
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-24 15:42 -0700
Re: size of Richard Damon <Richard@Damon-Family.org> - 2013-08-24 20:09 -0400
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-24 17:52 -0700
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-24 22:53 -0400
Re: size of Richard Damon <Richard@Damon-Family.org> - 2013-08-25 08:44 -0400
Re: size of Tim Rentsch <txr@alumni.caltech.edu> - 2013-08-26 14:27 -0700
Re: size of Tim Rentsch <txr@alumni.caltech.edu> - 2013-08-25 10:49 -0700
Re: size of Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-25 11:15 -0700
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-24 14:39 -0700
Re: size of Tim Rentsch <txr@alumni.caltech.edu> - 2013-08-25 18:32 -0700
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-25 19:48 -0700
Re: size of Tim Rentsch <txr@alumni.caltech.edu> - 2013-08-21 00:19 -0700
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-20 18:28 -0500
Re: size of Barry Schwarz <schwarzb@dqel.com> - 2013-08-20 22:02 -0700
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-20 23:13 -0700
Re: size of Tim Rentsch <txr@alumni.caltech.edu> - 2013-08-24 08:48 -0700
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-24 14:12 -0700
Re: size of Tim Rentsch <txr@alumni.caltech.edu> - 2013-08-24 20:35 -0700
Re: size of Tim Rentsch <txr@alumni.caltech.edu> - 2013-08-24 09:16 -0700
Re: size of Barry Schwarz <schwarzb@dqel.com> - 2013-08-24 15:14 -0700
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-24 15:51 -0700
Re: size of Tim Rentsch <txr@alumni.caltech.edu> - 2013-08-24 19:39 -0700
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-24 11:48 -0500
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-24 13:36 -0400
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-24 14:24 -0500
Re: size of Barry Schwarz <schwarzb@dqel.com> - 2013-08-24 15:14 -0700
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-24 15:46 -0700
Re: size of Barry Schwarz <schwarzb@dqel.com> - 2013-08-24 21:42 -0700
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-25 01:41 -0700
Re: size of Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2013-08-25 13:46 -0600
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-25 13:33 -0700
Re: size of Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2013-08-25 18:18 -0600
Re: size of Richard Damon <Richard@Damon-Family.org> - 2013-08-25 16:52 -0400
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-25 18:34 -0400
Re: size of Barry Schwarz <schwarzb@dqel.com> - 2013-08-25 16:20 -0700
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-25 21:01 -0400
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-25 19:33 -0700
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-24 23:08 -0400
Re: size of Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2013-08-25 13:44 -0600
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-25 13:31 -0700
Re: size of Barry Schwarz <schwarzb@dqel.com> - 2013-08-25 16:20 -0700
Re: size of Richard Damon <Richard@Damon-Family.org> - 2013-08-25 21:48 -0400
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-25 19:30 -0700
Re: size of Ian Collins <ian-news@hotmail.com> - 2013-08-26 14:45 +1200
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-25 20:08 -0700
Re: size of Tim Rentsch <txr@alumni.caltech.edu> - 2013-08-24 15:08 -0700
Re: size of Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-24 16:39 -0700
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-24 17:48 -0700
Re: size of Tim Rentsch <txr@alumni.caltech.edu> - 2013-08-24 17:55 -0700
Re: size of Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-20 01:02 -0700
Re: size of Ian Collins <ian-news@hotmail.com> - 2013-08-20 20:54 +1200
Re: size of Kelsey Bjarnason <kbjarnason@gmail.com> - 2013-08-20 02:39 -0700
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-20 08:15 -0500
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-20 08:17 -0700
Re: size of Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-20 13:58 -0700
Re: size of Ike Naar <ike@iceland.freeshell.org> - 2013-08-20 21:11 +0000
Re: size of gazelle@shell.xmission.com (Kenny McCormack) - 2013-08-20 21:21 +0000
Re: size of Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2013-08-20 16:21 -0600
Re: size of gazelle@shell.xmission.com (Kenny McCormack) - 2013-08-21 12:01 +0000
Re: size of Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2013-08-21 12:11 -0600
Re: size of gazelle@shell.xmission.com (Kenny McCormack) - 2013-08-22 09:19 +0000
Re: size of Ian Collins <ian-news@hotmail.com> - 2013-08-21 10:07 +1200
Re: size of glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-08-20 23:58 +0000
Re: size of Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2013-08-23 11:24 +0300
Re: size of glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-08-23 10:52 +0000
Re: size of "James Harris" <james.harris.1@gmail.com> - 2013-08-23 12:09 +0100
Re: size of Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2013-08-23 17:52 +0300
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-20 16:21 -0700
Re: size of Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-21 02:23 -0700
Re: size of glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-08-21 10:05 +0000
Re: size of Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-21 03:23 -0700
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-21 08:22 -0700
Re: size of Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-08-21 18:54 +0100
Re: size of Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-21 13:51 -0700
Re: size of Robert Wessel <robertwessel2@yahoo.com> - 2013-08-21 13:41 -0500
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-21 08:42 -0700
Re: size of Kelsey Bjarnason <kbjarnason@gmail.com> - 2013-08-20 20:44 -0700
Re: size of Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-08-21 02:30 -0700
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-21 08:30 -0700
Re: size of Kelsey Bjarnason <kbjarnason@gmail.com> - 2013-08-18 22:15 -0700
Re: size of Kelsey Bjarnason <kbjarnason@gmail.com> - 2013-08-18 22:08 -0700
Re: size of Tim Rentsch <txr@alumni.caltech.edu> - 2013-08-18 20:49 -0700
Re: size of Sjouke Burry <burrynulnulfour@ppllaanneett.nnll> - 2013-08-14 01:09 +0200
Re: size of Keith Thompson <kst-u@mib.org> - 2013-08-13 17:31 -0700
Re: size of Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2013-08-13 22:09 -0600
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-14 07:03 -0400
Re: size of Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2013-08-14 10:02 -0600
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-14 12:29 -0400
Re: size of Stephen Sprunk <stephen@sprunk.org> - 2013-08-14 14:44 -0500
Re: size of James Kuyper <jameskuyper@verizon.net> - 2013-08-14 16:03 -0400
csiph-web