As Richard Bos rightly pointed out, I had left in my classification
of types the C99 types Complex and boolean. Here is a new
classification. Those are not mentioned in the classification
of Plauger and Brody, probably because their work predates
C99. Since there are no examples of this in the literature
(known to me) please take a look.
Thanks
3.1.1 Arithmetic types
3.1.1.1 Integer types
3.1.1.1.1 Specific integer types
3.1.1.1.1.1 boolean type
3.1.1.1.1.2 char (signed/unsigned)
3.1.1.1.1.3 short (signed unsigned)
3.1.1.1.1.4 int (signed/unsigned)
3.1.1.1.1.5 long (signed/unsigned)
3.1.1.1.1.6 long long (signed/unsigned)
3.1.1.1.2 Bitfields (signed/unsigned)
3.1.1.1.3 Enumeration types
3.1.1.2 Floating types
3.1.1.2.1 Real types
3.1.1.2.1.1 float
3.1.1.2.1.2 double
3.1.1.2.1.3 long double
3.1.1.2.4 Complex types
3.1.1.2.4.1 float Complex
3.1.1.2.4.2 double Complex
3.1.1.2.4.2 long double Complex
I would define arithmetic types as those that define the 4 operations.
This distiguishes them from pointer types where addition and
subtraction are defined but not multiplication/division.
Is that correct?
jacob 27 2056
jacob navia wrote:
As Richard Bos rightly pointed out, I had left in my classification
of types the C99 types Complex and boolean. Here is a new
classification. Those are not mentioned in the classification
of Plauger and Brody, probably because their work predates
C99. Since there are no examples of this in the literature
(known to me) please take a look.
Thanks
3.1.1 Arithmetic types
3.1.1.1 Integer types
3.1.1.1.1 Specific integer types
3.1.1.1.1.1 boolean type
3.1.1.1.1.2 char (signed/unsigned)
Also "plain old char," a third type distinct from the other
two (even though it behaves identically to one of them).
3.1.1.1.1.3 short (signed unsigned)
3.1.1.1.1.4 int (signed/unsigned)
3.1.1.1.1.5 long (signed/unsigned)
3.1.1.1.1.6 long long (signed/unsigned)
How about wchar_t, size_t, ptrdiff_t, sig_atomic_t, wint_t,
and the <stdint.htype s?
3.1.1.1.2 Bitfields (signed/unsigned)
3.1.1.1.3 Enumeration types
3.1.1.2 Floating types
3.1.1.2.1 Real types
3.1.1.2.1.1 float
3.1.1.2.1.2 double
3.1.1.2.1.3 long double
float_t and double_t?
3.1.1.2.4 Complex types
3.1.1.2.4.1 float Complex
3.1.1.2.4.2 double Complex
3.1.1.2.4.2 long double Complex
time_t, clock_t, wctrans_t, and wctype_t are difficult to
categorize.
--
Eric Sosman es*****@acm-dot-org.invalid
Eric Sosman a écrit :
Also "plain old char," a third type distinct from the other
two (even though it behaves identically to one of them).
How about wchar_t, size_t, ptrdiff_t, sig_atomic_t, wint_t,
and the <stdint.htype s?
time_t, clock_t, wctrans_t, and wctype_t are difficult to
categorize.
As far as I understood this stuff, all those are defined in terms of
one of the primitive types in the enumeration above.
For instance, in many implementations size_t is unsigned long,
or time_t is long long, or clock_t is int, etc etc.
They are derived types defined in terms of a more primitive type.
The same applies to chart ("plain" char) since it is defined either
as unsigned or signed char, what means it is not another basic
type but a synonym for one of the char types.
jacob navia a écrit :
The same applies to chart ("plain" char)
Not "chart" but "char" of course. Excuse me.
jacob navia <ja***@jacob.re mcomp.frwrote:
Eric Sosman a écrit :
Also "plain old char," a third type distinct from the other
two (even though it behaves identically to one of them).
How about wchar_t, size_t, ptrdiff_t, sig_atomic_t, wint_t,
and the <stdint.htype s?
time_t, clock_t, wctrans_t, and wctype_t are difficult to
categorize.
As far as I understood this stuff, all those are defined in terms of
one of the primitive types in the enumeration above.
Not necessarily. For example, on historic implementations , time_t was
often larger than a single long, and was therefore a struct. Ditto for,
e.g., fpos_t. The point about such types is that they may be one
specific primitive type on any particular implementation, but to the
wise C programmer they must remain abstract types. As such, they deserve
discussion.
Richard
jacob navia wrote:
Eric Sosman a écrit :
> Also "plain old char," a third type distinct from the other two (even though it behaves identically to one of them). How about wchar_t, size_t, ptrdiff_t, sig_atomic_t, wint_t, and the <stdint.htype s? time_t, clock_t, wctrans_t, and wctype_t are difficult to categorize.
As far as I understood this stuff, all those are defined in terms of
one of the primitive types in the enumeration above.
For instance, in many implementations size_t is unsigned long,
or time_t is long long, or clock_t is int, etc etc.
"In many implementations " doesn't quite make the grade for
a treatise that is supposed to be about the language and not
about particular implementations of it. "In many implementations "
it is true that INT_MIN < -INT_MAX, but that's not true of the
language per se.
Even in C90 I'm not entirely sure that all the "named for a
purpose" types were required to be aliases of "ordinary" types as
opposed to implementation-defined "exotic" types. Certainly in
C99 the lid came off, and int_least16_t (for example) might not
be a synonym for any kind of char, short, or int.
The same applies to chart ("plain" char) since it is defined either
as unsigned or signed char, what means it is not another basic
type but a synonym for one of the char types.
The Standard disagrees with you (6.2.5/14). `char' is a
type unto itself, distinct from both `signed char' and
`unsigned char'. `int' and `short' are distinct types even
when both are 16 bits wide; `int' and `long' are distinct even
when both are 32 bits wide; `double' and `long double' are
distinct even when both are IEEE double-precision numbers.
Representation and behavior are not the sole ingredients of
"type."
--
Eric Sosman es*****@acm-dot-org.invalid
"Eric Sosman" <es*****@acm-dot-org.invalidwrot e in message
news:8o******** *************** *******@comcast .com...
jacob navia wrote:
>As Richard Bos rightly pointed out, I had left in my classification of types the C99 types Complex and boolean. Here is a new classification . Those are not mentioned in the classification of Plauger and Brody, probably because their work predates C99. Since there are no examples of this in the literature (known to me) please take a look.
For an update of the Plauger & Brodie documentation, see the C
portion of our on-line manual: http://www.dinkumware.com/manuals/
>3.1.1 Arithmetic types 3.1.1.1 Integer types 3.1.1.1.1 Specific integer types 3.1.1.1.1.1 boolean type 3.1.1.1.1.2 char (signed/unsigned)
Also "plain old char," a third type distinct from the other
two (even though it behaves identically to one of them).
> 3.1.1.1.1.3 short (signed unsigned) 3.1.1.1.1.4 int (signed/unsigned) 3.1.1.1.1.5 long (signed/unsigned) 3.1.1.1.1.6 long long (signed/unsigned)
How about wchar_t, size_t, ptrdiff_t, sig_atomic_t, wint_t,
and the <stdint.htype s?
> 3.1.1.1.2 Bitfields (signed/unsigned) 3.1.1.1.3 Enumeration types 3.1.1.2 Floating types 3.1.1.2.1 Real types 3.1.1.2.1.1 float 3.1.1.2.1.2 double 3.1.1.2.1.3 long double
float_t and double_t?
> 3.1.1.2.4 Complex types 3.1.1.2.4.1 float Complex 3.1.1.2.4.2 double Complex 3.1.1.2.4.2 long double Complex
time_t, clock_t, wctrans_t, and wctype_t are difficult to
categorize.
What the standard says about each of these types is summarized
in our manual.
P.J. Plauger
Dinkumware, Ltd. http://www.dinkumware.com
P.J. Plauger a écrit :
"Eric Sosman" <es*****@acm-dot-org.invalidwrot e in message
news:8o******** *************** *******@comcast .com...
>>jacob navia wrote:
>>>As Richard Bos rightly pointed out, I had left in my classification of types the C99 types Complex and boolean. Here is a new classificati on. Those are not mentioned in the classification of Plauger and Brody, probably because their work predates C99. Since there are no examples of this in the literature (known to me) please take a look.
For an update of the Plauger & Brodie documentation, see the C
portion of our on-line manual:
http://www.dinkumware.com/manuals/
>>>3.1.1 Arithmetic types 3.1.1.1 Integer types 3.1.1.1.1 Specific integer types 3.1.1.1.1.1 boolean type 3.1.1.1.1.2 char (signed/unsigned)
Also "plain old char," a third type distinct from the other two (even though it behaves identically to one of them).
>> 3.1.1.1.1.3 short (signed unsigned) 3.1.1.1.1.4 int (signed/unsigned) 3.1.1.1.1.5 long (signed/unsigned) 3.1.1.1.1.6 long long (signed/unsigned)
How about wchar_t, size_t, ptrdiff_t, sig_atomic_t, wint_t, and the <stdint.htype s?
>> 3.1.1.1.2 Bitfields (signed/unsigned) 3.1.1.1.3 Enumeration types 3.1.1.2 Floating types 3.1.1.2.1 Real types 3.1.1.2.1.1 float 3.1.1.2.1.2 double 3.1.1.2.1.3 long double
float_t and double_t?
>> 3.1.1.2.4 Complex types 3.1.1.2.4.1 float Complex 3.1.1.2.4.2 double Complex 3.1.1.2.4.2 long double Complex
time_t, clock_t, wctrans_t, and wctype_t are difficult to categorize.
What the standard says about each of these types is summarized
in our manual.
P.J. Plauger
Dinkumware, Ltd. http://www.dinkumware.com
Thanks for your answer Mr Plauger but I could not find that type
classification there. Maybe you would give a more specific link?
I browsed a lot of C stuff (and C++ stuff) but could not find it.
Thanks
jacob navia <ja***@jacob.re mcomp.frwrites:
Eric Sosman a écrit :
> Also "plain old char," a third type distinct from the other two (even though it behaves identically to one of them). How about wchar_t, size_t, ptrdiff_t, sig_atomic_t, wint_t, and the <stdint.htype s? time_t, clock_t, wctrans_t, and wctype_t are difficult to categorize.
As far as I understood this stuff, all those are defined in terms of
one of the primitive types in the enumeration above.
For instance, in many implementations size_t is unsigned long,
or time_t is long long, or clock_t is int, etc etc.
They're typedefs for some predefined integer type, possible an
extended integer type (which you didn't mention).
Incidentally, be careful with the word "enumeratio n" in this context.
They are derived types defined in terms of a more primitive type.
No, the standard defines the term "derived type" (C99 6.2.5p20);
typedefs do not create derived types. If you're going to invent
terminology, be *very* careful to remain consistent with the standard.
Better yet, just use the standard's own terminology.
The same applies to chart ("plain" char) since it is defined either
as unsigned or signed char, what means it is not another basic
type but a synonym for one of the char types.
No, type char is distinct from both signed char and unsigned char,
though it has the same characteristics as one of them. This usually
doesn't matter due to implicit conversions, but these types:
char*
unsigned char*
signed char*
are all incompatible; values of these types cannot be assigned to each
other without a cast. If char were an alias for either signed char or
unsigned char, this would not be the case. (Does lcc-win32 get this
right?)
--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this. rl*@hoekstra-uitgeverij.nl (Richard Bos) writes:
jacob navia <ja***@jacob.re mcomp.frwrote:
>Eric Sosman a écrit :
Also "plain old char," a third type distinct from the other
two (even though it behaves identically to one of them).
How about wchar_t, size_t, ptrdiff_t, sig_atomic_t, wint_t,
and the <stdint.htype s?
time_t, clock_t, wctrans_t, and wctype_t are difficult to
categorize.
As far as I understood this stuff, all those are defined in terms of one of the primitive types in the enumeration above.
Not necessarily. For example, on historic implementations , time_t was
often larger than a single long, and was therefore a struct. Ditto for,
e.g., fpos_t. The point about such types is that they may be one
specific primitive type on any particular implementation, but to the
wise C programmer they must remain abstract types. As such, they deserve
discussion.
Yes, but the standard specifically requires time_t to be an arithmetic
type (though there's not much you can do in portable code to take
advantage of this).
--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Lionel B |
last post by:
Greetings,
I am trying to implement "element-wise" arithmetic operators for a class
along the following lines (this is a simplified example):
// ----- BEGIN CODE -----
struct X
{
int a,b;
|
by: TTroy |
last post by:
Hello, I'm relatively new to C and have gone through more than 4 books
on it. None mentioned anything about integral promotion, arithmetic
conversion, value preserving and unsigned preserving. And K&R2
mentions "signed extension" everywhere.
Reading some old clc posts, I've beginning to realize that these books
are over-generalizing the topic. I am just wondering what the
difference between the following pairs of terms are:
1)...
|
by: PDHB |
last post by:
I'm sorry, but this is just the height of stupidity.
I love the dot net framework. It has actually been sufficient to convert an
anti-microsoft extremist (myself) to the windows camp. But not having
numerical value types inherit from an interface to allow for arithmetic in
generics, or in some other way allow arithmetic in generics without a
performance killing or ugly work around is just the epitomy of idiocy.
Yes, microsoft today is...
|
by: Frederick Gotham |
last post by:
I just want to clarify my understanding of arithmetic and comparison
between two different integer types.
Phase (1): Integer Promotion
----------
All of the following types always get promoted to "signed int":
signed char
|
by: Bill Reid |
last post by:
Bear with me, as I am not a "professional" programmer, but I was
working on part of program that reads parts of four text files into
a buffer which I re-allocate the size as I read each file. I read some
of the items from the bottom up of the buffer, and some from the
top down, moving the bottom items back to the new re-allocated
bottom on every file read.
Then when I've read all four files, I sort the top and bottom items
separately...
| |
by: sarathy |
last post by:
Hi,
What is integer promotion? How is it different from
arithmetic conversion?
Regards,
Sarathy
|
by: Grant Robertson |
last post by:
I am interested in including classification info in metadata. I am aware
of the Dublin Core and XMP. However, neither of these appear to specify
exactly how the classification data should be formatted within the
element.
I am interested in any standardized formats for expressing Dewey Decimal
System - DDS, Library of Congress Classification - LCC, Cutter Expansive
Classification, Universal Decimal Classification - UDC, Colon Notation...
|
by: Evan Klitzke |
last post by:
Hi all,
What frameworks are there available for doing pattern classification?
I'm generally interested in the problem of mapping some sort of input
to one or more categories. For example, I want to be able to solve
problems like taking text and applying one or more tags to it like
"romance", "horror", "poetry", etc. This isn't really my research
specialty, but my understanding is that Bayesian classifiers are
generally used for problems...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |