Uses of Short
COTTRELL, JAMES
cottrell at nbs-vms.ARPA
Tue Sep 10 02:10:40 AEST 1985
/*
Someone asked `what are the uses of short?' with specific interest in
machines where `sizeof(short) = sizeof(int)' (he really means `==' :-)
to which Guy Harris replies: `AAAAAAIIIIEEEEEEEEEE' followed by lots of
words of wisdom. Except he didn't answer the question: `What *are* the
uses of short?' I don't disagree with anything he said & I would sincerely
like to hear his answer. `What are the stimuli that would provoke Guy
to respond by typing `short' at the C compiler?'
Perhaps the type short was conceived as a way to conveniently write
machine *dependent* code, (such as getting at device registers) &
create explicitly packed struxures for the nonportable parts of the
operating system. If one is supplying the source code, then even such
construx as the following will be portable with sufficient warning.
#ifdef PARANOID
typedef short small;
#else
typedef int small;
OOPS! I got it backwards (I'm typing directly, no editor), make that
`#ifndef'. The ANSI C std should help clear up matters as well.
jim cottrell at nbs
*/
------
More information about the Comp.lang.c
mailing list