Standard integer types vs <stdint.h> types

C

Chris Hills

Malcolm McLean said:
bool breaks libraries.

If ANSI decides that "s64" shall be the name of a new type, that's
fine.

Only if they get it past the other 30-40 nations defining C
If I define it myself, either the whole world adopts my convention,
which is to say I have usurrped ANSI / ISO,

You could get them to adopt it.
it is a nuisance to everybody trying to call or read my code.

No change there then :))))
 
R

Richard Bos

Chris Hills said:
Signed and unsigned char are integer types.
Plain char is a character type (and the signed/unsigned is
implementation dependant)

Both true, but irrelevant. And it surprised me that a member of the
Committee doesn't know his Standard well enough to realise that it is
irrelevant, because:

(All from C99 (don't remember which version), 6.2.5, by the way.
Something very similar is in C94.)

# There are five standard signed integer types, designated as signed
# char ... The standard and extended signed integer types are
# collectively called signed integer types.

# For each of the signed integer types, there is a corresponding (but
# different) unsigned integer type (designated with the keyword
# unsigned) ... and the unsigned integer types that correspond to the
# standard signed integer types are the standard unsigned integer types.

# The three types char, signed char, and unsigned char are collectively
# called the character types.

# The type char, the signed and unsigned integer types, and the
# enumerated types are collectively called integer types.

Therefore plain char, signed char, and unsigned char _all three_ are
integer types, and all three are character types. There is no different
whatsoever in this respect between the three varieties of char.

Richard
 
C

Chris Hills

Ian Collins said:
Does every word posted here have to be in the ISO C standard to meet
with your approval? Read what I was answering.

Ignore him.

There are a small band of zealots on c.l.c who use the C standard like
fundamental Christians read the Bible.
 
D

dj3vande

dj3vande said:
In a mathematical context, it's quite common to hear mathematicians
making claims like "the reals are a superset of the rationals".

Except they're not; the rationals are equivalence classes over ordered
pairs of integers, and the reals are sets of rationals[1], so no
rational number can possibly be a real number. This doesn't keep it
from being understood as "the rationals are isomorphic to a subset of
the reals", for both the person making the claim and the person hearing
it.
[1] Sometimes. There are several equivalent constructions, but these
are the ones that I saw in my math courses.
But, as far as I know, it's impossible to construct the reals in a
way that makes them look the same as the rationals, which is my
point here.

Take the set of real numbers, remove the ones in the subset isomorphic to
Q, and replace them with the true Q.

If you're working at the level where it makes sense to want to do that,
then by going ahead and doing it you'll break things.
F'rexample, if you've constructed R with Dedekind cuts, you've defined
real numbers as sets of rationals with some convenient properties, and
real addition ends up being defined as
A + B := {a+b|a in A, b in B}
If you replace the real zero {x in Q: x < 0} with the rational zero
[(0,1)]={(a,b): a,b in Z, a=0, b!=0}, then trying to add something like
0+sqrt(2) gives you... well, something that you can't evaluate with
either rational addition or real addition.

What you end up doing is proving that there's a sensible embedding,
i.e. the real number {x in Q: x < q} has all the properties you would
expect the rational number q to have.
Once you've done that, you then freely go ahead and treat the rationals
as a subset of the reals, with following the embedding bijection
implied when you say things like "Take pi and multiply it by a rational
number" instead of having to specify "Take pi and multiply it by
embed(q) where q is a rational number".


dave
 

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

Similar Threads

C99 integer types 24
Types 58
Types in C 117
Integer types in embedded systems 22
C99 stdint.h 20
Performance of signed vs unsigned types 84
ansi types 11
using pre-processor to count bits in integer types... 17

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top