Sujet : Re: Integral types and own type definitions (was Re: Suggested method for returning a string from a C program?)
De : tr.17687 (at) *nospam* z991.linuxsc.com (Tim Rentsch)
Groupes : comp.lang.cDate : 25. Mar 2025, 12:55:13
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <86frj1jpem.fsf@linuxsc.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
User-Agent : Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Janis Papanagnou <janis_papanagnou+
ng@hotmail.com> writes:
On 25.03.2025 05:56, Tim Rentsch wrote:
>
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>
[...]
>
When I started with "C" or C++ there were not only 8-bit
multiples defined for the integral types; [...]
>
In C the correct phrase is integer types, not integral types.
>
My apologies if I'm using language independent terms.
The problem is that what was written used the word "integral"
incorrectly.
I'm confident, though, that most people (obviously you as well)
understood the term.
It is likely that I would understand what was meant if someone
said they wanted to "pay me a complement", but that doesn't
mean the usage is correct English. "Complement" and "compliment"
don't mean the same thing.
I understand that the "C" standard may have consistently been using
another naming. - Frankly, I'm a bit puzzled that general (language
independent) terms are considered "incorrect" by the audience here.
The words "integer" and "integral" are not specific to programming
languages. They have well-established meanings in English, and mean
different things. People who think "integer" and "integral" can be
used interchangeably are illiterate, at least with respect to this
one aspect of the English language.
The constant 3.0, for example, has an integral value, but it
does not have an integer value.
>
The literal "3.0" is usually not representing the value of an
integral [data] type like 'int'.[*]
In C the word is constant, not literal; literals are something
else.
Again the word "integral" is being used incorrectly. The type int
is an integer data type. If a real number r has a value not equal
to zero, then r/r has an integral value, but it is still a real
number, and not an integer.
(You are speaking about "integral value" here,
I was illustrating a correct usage of the word "integral", and also
showing the distinction between the adjective "integral" and the
adjective "integer".
I was speaking about the "integral [data] types". Not sure why
you shifted the goalpost.)
I gave an example to illustrate correct usage. If someone thinks
what I said was shifting some sort of goalpost then they didn't
understand the point I was making.
[*] For languages that don't have a distinguished integral numeric
data type, or that do implicit coercion, things may be different of
course.
One more time: it is INTEGER data type, not INTEGRAL data type.
Certainly it is possible to imagine a floating-point representation
that was constrained in some way so that any fractional part is
always zero, but also has NaNs, and such a representation could
plausibly be called an INTEGRAL data type. Another example is a
fixed-point data type that has a scale factor of 1024 (so only
multiples of 1024 are representable): such a data type has INTEGRAL
values, but isn't suitable for holding INTEGER values.
The important point here is not that C defines these two terms
differently, and indeed it doesn't define them at all, but that
the C standard correctly uses the English word "integer", and
does not make the mistake of incorrectly using the different
English word "integral", when "integer data types" are being
discussed.
(The C90 standard mistakenly used "integral", but that mistake
was corrected in C99.)