char vs int

D

Dan Pop

In said:
void is an incomplete type, not an object type.

No one said it's an object type, but a valid, non-null void pointer
value can only be pointing to an object. Hence the weirdness of void.

Dan
 
J

John Bode

Merrill & Michele said:
Those are "derived type," as others have mentioned.
But what about `short int', `long int', and `long double'?
And then there are the `unsigned' variants ... Despite
the multi-word names, these are in no sense "derived"
types. Finally there's `void' -- which might be excluded
from the ranks of "data types" by virtue of its weirdness.

My guess is that one needs to read a little more of
K&R's context to understand what they mean by "basic."


You'd be stuck reading tea leaves with the K&R context here. short, long,
signed and unsigned are mentioned along with the basic data declarations,
but I have yet to stumble across a sentence that says, "well folks, chp. 2
is long behind us, and we're going to nuance this discussion of type." And
please don't ask me why Mr. Sosman's comments don't have arrows on them.
MPJ


You might want to look at other references as well. My primary
reference is Harbison & Steele, and here's how they organize types:

Scalar Types
Arithmetic Types
Integral Types
short, int, long, long long (signed/unsigned)
char (signed/unsigned)
_Bool
enum {...}

Floating-point Types
float, double, long double
float _Complex, double _Complex, long double _Complex,
float _Imaginary, double _Imaginary,
long double _Imaginary

Pointer Types
T *

Aggregate Types
Array Types
T [...]

Structure Types
struct {...}

Union Types
union {...}

Function Types
T (...)

Void Type
void

H&S don't try to distinguish between "basic" and "derived" types, and
I'm not sure I could do so. I've never had to worry about it in the
past. I would imagine that enum, char, short, int, long, long long,
float, double, and long double are basic types; everything else
(pointers, arrays, structs, unions, etc.) is derived from those types.
 
K

Kevin D. Quitt

Don't underestimate my ability to be simultaneously mistaken and ignorant.

Grabbed. Generalized to be M&M corollary of Sprague's law.

Sprague's Law:
"There are three orders of magnitude more dumbshits in the world than
there can be any use for." --William Sprague

Quitt's Clarification to Sprague's Law:
"Stupid isn't not being smart; stupid is not using one's smarts."
--Kevin D. Quitt

The M&M corollary of Sprague's law:
"Don't underestimate the ability to be simultaneously mistaken and
ignorant." --Merrill & Michele

In answer to "How can people be so stupid as to...":
"We all do what we're good at." --Kevin D. Quitt
 
M

Merrill & Michele

John Bode said:
"Merrill & Michele" <[email protected]> wrote in message
Those are "derived type," as others have mentioned.
But what about `short int', `long int', and `long double'?
And then there are the `unsigned' variants ... Despite
the multi-word names, these are in no sense "derived"
types. Finally there's `void' -- which might be excluded
from the ranks of "data types" by virtue of its weirdness.

My guess is that one needs to read a little more of
K&R's context to understand what they mean by "basic."


You'd be stuck reading tea leaves with the K&R context here. short, long,
signed and unsigned are mentioned along with the basic data declarations,
but I have yet to stumble across a sentence that says, "well folks, chp. 2
is long behind us, and we're going to nuance this discussion of type." And
please don't ask me why Mr. Sosman's comments don't have arrows on them.
MPJ


You might want to look at other references as well. My primary
reference is Harbison & Steele, and here's how they organize types:

Scalar Types
Arithmetic Types
Integral Types
short, int, long, long long (signed/unsigned)
char (signed/unsigned)
_Bool
enum {...}

Floating-point Types
float, double, long double
float _Complex, double _Complex, long double _Complex,
float _Imaginary, double _Imaginary,
long double _Imaginary

Pointer Types
T *

Aggregate Types
Array Types
T [...]

Structure Types
struct {...}

Union Types
union {...}

Function Types
T (...)

Void Type
void

H&S don't try to distinguish between "basic" and "derived" types, and
I'm not sure I could do so. I've never had to worry about it in the
past. I would imagine that enum, char, short, int, long, long long,
float, double, and long double are basic types; everything else
(pointers, arrays, structs, unions, etc.) is derived from those types.
I'm due to spend another $50 on a C book. Since H&S is referenced in the
FAQs, I'll go with that. MPJ
 
M

Merrill & Michele

Kevin D. Quitt said:
ignorant.

Grabbed. Generalized to be M&M corollary of Sprague's law.

Sprague's Law:
"There are three orders of magnitude more dumbshits in the world than
there can be any use for." --William Sprague

Quitt's Clarification to Sprague's Law:
"Stupid isn't not being smart; stupid is not using one's smarts."
--Kevin D. Quitt

The M&M corollary of Sprague's law:
"Don't underestimate the ability to be simultaneously mistaken and
ignorant." --Merrill & Michele

In answer to "How can people be so stupid as to...":
"We all do what we're good at." --Kevin D. Quitt


--
#include <standard.disclaimer>
_
Kevin D Quitt USA 91387-4454 96.37% of all statistics are made up
Per the FCA, this address may not be added to any commercial mail list
Many people might find uncomfortable having one's shortcomings turned into a
"law." I like to think of it as being unafraid to leave my zone of comfort
to try a new dance. MPJ
 
J

Joona I Palaste

Merrill & Michele said:
Many people might find uncomfortable having one's shortcomings turned into a
"law." I like to think of it as being unafraid to leave my zone of comfort
to try a new dance. MPJ

Please snip away other people's signatures before replying, or reply
between the content and the signature. The way you did it, your reply
appears as part of Kevin's signature.
 
P

pete

Dan said:
No one said it's an object type,

That's why I said it.
OP listed some object types and mentioned their variants
and then mused about why void was different.
but a valid, non-null void pointer
value can only be pointing to an object. Hence the weirdness of void.

All pointers to incomplete types are like that.
Incomplete types don't have values and
pointers to incomplete types don't have arithmetic.
 
D

Dan Pop

In said:
That's why I said it.

So, you're talking out of context.
OP listed some object types and mentioned their variants
and then mused about why void was different.


All pointers to incomplete types are like that.

Yes, but void is, by far, the most important incomplete type. Few
programs use other incomplete types or pointers to them.
Incomplete types don't have values and
pointers to incomplete types don't have arithmetic.

GNU C defines pointer arithmetic on void pointers and this is a fairly
useful feature. Too bad it was ignored by the C standardisation process.

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,155
Messages
2,570,871
Members
47,401
Latest member
CliffGrime

Latest Threads

Top