Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: short int always 16 bits or not?

Reply
Thread Tools

Re: short int always 16 bits or not?

 
 
Barry Schwarz
Guest
Posts: n/a
 
      04-20-2013
On Fri, 19 Apr 2013 17:14:26 -0700 (PDT), Shriramana Sharma
<(E-Mail Removed)> wrote:

>Hello. I am reading the C99 standard as available from: http://www.open-std.org/jtc1/sc22/WG...docs/n1256.pdf
>
>I note that it specifies (on p 34) macros defining the minimum and maximum values of a short int corresponding to a size of 16 bits. However it doesn't explicitly say that short int-s should be of 16 bits size. So can I trust short int-s to be 16 bits size or not?


You need to go to page 33 and read the last sentence that introduces
the table on page 34.

>Also, doesn't prescribing #define-s for integer type min/max values conflict with the general (?) understanding that the size of these types are implementation defined? I mean, is the general understanding wrong? (For instance see: http://en.wikipedia.org/wiki/Short_i...e_b_grp_notesc)


In what way? Since both the value of the type and the size of the
type are determined by the particular implementation, why would they
be inconsistent? What would be inconsistent is using the values from
one implementation on a different one.

>Finally, why would anyone want char to be other than 8 bits? *Is* char on any platform *not* 8 bits?


Because the real world is not limited to your imagination. (There are
even character encoding schemes other than ASCII.)

Yes.

--
Remove del for email
 
Reply With Quote
 
 
 
 
Edward A. Falk
Guest
Posts: n/a
 
      04-22-2013
In article <(E-Mail Removed)>,
Gordon Burditt <(E-Mail Removed)> wrote:
>
>Old (obsolete) systems include the PDP-8, with 12 bit wide memory
>and registers, and the GE-635 which used 36-bit-wide memory where
>characters were either 6 or 9 bits, selectable by a bit in a tally
>word (which now might be called a "fat pointer")...


And the PDP-10 which packed five 7-bit characters into a 36-bit word.

And don't get started on the sixbit and radix-50 alphabets used
by the pdp-10 and pdp-11 respectively.

--
-Ed Falk, http://www.velocityreviews.com/forums/(E-Mail Removed)
http://thespamdiaries.blogspot.com/
 
Reply With Quote
 
 
 
 
glen herrmannsfeldt
Guest
Posts: n/a
 
      04-22-2013
Edward A. Falk <(E-Mail Removed)> wrote:
> In article <(E-Mail Removed)>,
> Gordon Burditt <(E-Mail Removed)> wrote:


>>Old (obsolete) systems include the PDP-8, with 12 bit wide memory
>>and registers, and the GE-635 which used 36-bit-wide memory where
>>characters were either 6 or 9 bits, selectable by a bit in a tally
>>word (which now might be called a "fat pointer")...


> And the PDP-10 which packed five 7-bit characters into a 36-bit word.


> And don't get started on the sixbit and radix-50 alphabets used
> by the pdp-10 and pdp-11 respectively.


I used to write programs in PDP-10 Fortran that would read 9 track
tapes with EBCDIC data and convert to ASCII. I believe it reads four
tape bytes into a 36 bit word.

There is also a way to write 36 bit words to tape, and read them back
again, which I believe writes two words to nine tape bytes.

But yes, the normal ASCII form for PDP-10 data files stores five
characters per word, with one bit left over. Line oriented editors
would write five digit line numbers in the first word of the line,
with the low bit set. Compilers would recognize those, ignore the number
as far as program input went, but use the number in error messages.

It would confuse TECO users, though, if you sent them line numbered
files.

-- glen
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
shifting bits, shift 32 bits on 32 bit int GGG C++ 10 07-06-2006 06:09 AM
creating int from contiguous bits in an int Digital Puer C Programming 7 11-28-2005 06:42 AM
int main(int argc, char *argv[] ) vs int main(int argc, char **argv ) Hal Styli C Programming 14 01-20-2004 10:00 PM
8-Bits vs 12 or 16 bits/pixel; When does more than 8 bits count ? Al Dykes Digital Photography 3 12-29-2003 07:08 PM
dirty stuff: f(int,int) cast to f(struct{int,int}) Schnoffos C Programming 2 06-27-2003 03:13 AM



Advertisments