Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | "Bill Cunningham" <nospam@nspam.invalid> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: C89 compatibility question |
| Date | 2015-07-27 14:23 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <mp5sss$ihk$1@dont-email.me> (permalink) |
| References | <mp5agt$sos$1@dont-email.me> <mp5r8t$925$1@news2.informatik.uni-stuttgart.de> |
"Thomas Richter" <thor@math.tu-berlin.de> wrote in message
news:mp5r8t$925$1@news2.informatik.uni-stuttgart.de...
> Am 27.07.2015 um 15:10 schrieb Bill Cunningham:
>> I have this code so far to read a JFIF file and prehaps put it in a
>> wrapper of sorts.
>
> Despite your question: If so, why don't you use readily available
> libraries for doing so?
I will want my own file signatures and such. And I might want to do more
later than just a wrapper. For example, this code is to determine whether or
not a file is raw or compressed. Or even non-standard. But I intend it to
say also if a file is a JPEG and in the same family to see that and not deal
with JPEGs.
>
>>
>> Struct JFIF_HEAD {
>> uint8_t SOI={0xff,0xd8};
>>
>
> How that should compile I'm unclear about. This looks like it is missing a
> [] behind SOI.
Right. I forgot. It should be SOI[2]={0xff,0xd8};
>> Not much I know. But I am already going to have to use stdint.h which is
>> fine for me; but not C89. Is there an unsigned int that can be 8 bit in
>> C89?
>
> In many if not most architectures, this is what "unsigned char" will do.
But won't that force me into having to use ascii values? For example,
unsigned char SOI[2]={'0xff','0xd8'};
I will get ascii values here I am pretty sure. That's not what I want. I
don't want a string either. That's a later member in this struct.
>> The only thing in C89 I know of that is 8 bit is a char.
>
> Nope. C89 does not ensure that. A char is anything the architecture can
> provide, with a range of at least -127 to 127 or 0 to 255, but it can be
> more. There are architectures where a char is the same size as an int, and
> 16 bit or even 32 bit. It does not even have to be a multiple of 8 bits
> large. Actually, it does not even need to be a binary machine...
>
>> Could anything C89 replace uint8_t?
>
> See above. For many architectures, "unsigned char" does, but it does not
> need to. Actually, on architectures where unsigned char is not 8 bit wide,
> it is also quite likely that uint8_t does not exist either.
>
> IOW, you may not even want to bother for such architectures and use
> "unsigned char" right away.
>
> Greetings,
> Thomas
>
>
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
C89 compatibility question "Bill Cunningham" <nospam@nspam.invalid> - 2015-07-27 09:10 -0400
Re: C89 compatibility question Philipp Klaus Krause <pkk@spth.de> - 2015-07-27 17:50 +0200
Re: C89 compatibility question "Bill Cunningham" <nospam@nspam.invalid> - 2015-07-27 12:25 -0400
Re: C89 compatibility question "Bill Cunningham" <nospam@nspam.invalid> - 2015-07-27 14:36 -0400
Re: C89 compatibility question Thomas Richter <thor@math.tu-berlin.de> - 2015-07-27 19:54 +0200
Re: C89 compatibility question "Bill Cunningham" <nospam@nspam.invalid> - 2015-07-27 14:23 -0400
Re: C89 compatibility question Barry Schwarz <schwarzb@dqel.com> - 2015-07-27 17:24 -0700
Re: C89 compatibility question "Bill Cunningham" <nospam@nspam.invalid> - 2015-07-28 13:57 -0400
Re: C89 compatibility question "Bill Cunningham" <nospam@nspam.invalid> - 2015-07-27 14:27 -0400
Re: C89 compatibility question Keith Thompson <kst-u@mib.org> - 2015-07-27 11:51 -0700
Re: C89 compatibility question "Bill Cunningham" <nospam@nspam.invalid> - 2015-07-27 14:53 -0400
Re: C89 compatibility question "Bill Cunningham" <nospam@nspam.invalid> - 2015-07-27 18:10 -0400
Re: C89 compatibility question Keith Thompson <kst-u@mib.org> - 2015-07-27 16:22 -0700
Re: C89 compatibility question "Bill Cunningham" <nospam@nspam.invalid> - 2015-07-28 09:28 -0400
Re: C89 compatibility question Keith Thompson <kst-u@mib.org> - 2015-07-28 10:36 -0700
csiph-web