Has thought been given given to a cleaned up C? Possibly called C+.

  • Thread starter Casey Hawthorne
  • Start date
T

Thomas Richter

jacob said:
I posted an article about the threading proposal in comp.std.c.

It is basically the documentation of a threading library of
Plauger.

The actual function calls in the library are probably the most harmless
part of threading support.
o The library is an unchanged copy of the C library of 1980. Using
the same software today after 30 years of development (and what a
development) in this field is plain nonsense.

Given the amount of existing code that builds on the existing C library,
replacing it is actually plain nonsense.
Many proposals have
been done to update the C library, specifically to correct the obvious
lack of security and error handling. Yes, the committee got rid of
gets() (could have been done in 1999) and acknowledged the buffer
overflow in the asctime() code, but still, there are a LOT of
functions in the standard library, specially the string handling
functions that are plainly WRONG...

I don't think they're wrong. They require care, care some people forgot.
As for example checking for the proper buffer size. A "strcpy" can be
absolutely correct if you have control on the size of the input string,
and it can be completely fatal if not. If you want to avoid the hassle,
go for C++, or use the limiting functions. "strncpy" is, however, indeed
broken, but it is too late to fix it. There is "strncpy_s" to address this.
How can we keep strtok and be multi-threading at the same time?

You can't. You use strtok_s for that. Breaking *existing* code is *not*
an option.
I did not see any update for multi-threading in the fopen/fclose
and all the functions of the standard library.

Why has fopen() a multithreading issue? It only has if the
implementation is broken???
o There is no standard way of making a list/a tree/ a flexible array/
in C. Everything must be ported, recompiled, etc. I am working in
a proposalfor this, but apparently the committee will decide a
feature freeze next meeting, so I will have to wait till 2020
at least.

Why should there? C is a very small language, and I really don't see the
need for such simple data structures in the standard. If you need
library support for that, and a richer structure that helps you with
such containers, use C++ and the STL. This is what it has been designed for.

So long,
Thomas
 
R

Richard Bos

Seebs said:
Could you offer some kind of support for this? I've seen several committee
members advocating for various changes.

I would agree that many of them do not agree with you about WHICH changes
are good, but it seems pretty clear that most of the people who have been
involved with C standardizations have been very interested in seeing SOME
kind of changes.

Furthermore, I find it incomprehensible that you wouldn't know this, given
prior conversations in which multiple examples of this were given.

s/incom/re/, and s/n't/ pretend not to/, IYAM.

Richard
 
J

jacob navia

Thomas Richter a écrit :
Given the amount of existing code that builds on the existing C library,
replacing it is actually plain nonsense.

Nobody is proposing that. This is an old trick in this discussions. Any
improvement to C is impossible because the old code. That is plainly not
true. The old code and the associated functions can be kept, but C
should be able to use BUFFERS of KNOWN length, avoiding the most common
cause of buffer overflows. Let's be explicit:

typedef struct {size_t length; char data[];} Buffer;

memset can be done as "Memset", for instance like this
bool Memset(Buffer *dest, int char_val);

where:
The result is zero if buffer is NULL, 1 if buffer is not null.

This is an easy example. Strcpy is just as trivial, but with a character
buffer.


Giving a similar but different name easies the porting and is compatible
with old code.

Why argument with flawed arguments? I DID tell jun my message that I
renamed the string functions Strcpy for instance. Why arguing that I
`want to "replace" strcpy"? Of course I want to replace the
functionality, making it less error prone, but not the function.
I don't think they're wrong. They require care, care some people forgot..

This has been discussed and discussed, and the essential point is that
if somebody makes a mistaken once, it is his/her fault. Ifvthousands of
programmers make always the same errors it is the tool's fault. In this
group, r Heathfield, an experienced C programmer had to acknowledge
that his published code had a BUG in his code handling string data.


And Mr Heathfield has been somebody that ALWAYS sys exactly the same as
you now. "You have to be careful" etc. But he himself was proved wrong.

I am sure you can be proved wrong too.
As for example checking for the proper buffer size. A "strcpy" can be
absolutely correct if you have control on the size of the input string,
and it can be completely fatal if not.

Exactly. A better version would use COUNTED buffers!
If you want to avoid the hassle,
go for C++, or use the limiting functions.

Here we have it again. Any development of C is always answered with
"Go to C++" even by committee members. C should remain full of warts
so that C++ can be seen as the only alternative. There should be NO
simpler language than C++, all development of C as a language should
STOP.

You are confirming what I say about committee members.

{snip}
Why should there? C is a very small language, and I really don't see the
need for such simple data structures in the standard.

Then, each C programmer needs to port a library that does lists,
flexible arrays, or find and debug one and port it, etc.

If you need
library support for that, and a richer structure that helps you with
such containers, use C++ and the STL.

OF COURSE that is the solution. Yu are (again) confirming what I said:
All development in C should stop and we should swallow C++ if we want to
do the simplest tasks!

If we want to use (portably) a list, we are forced to use C++ and
their STL...


This is what it has been designed
for.

C is still being used, and many important projects are based on it. My
thesis is that a simple language is necessary and useful. Adding
a general and extensible container interface for C doesn't change at all
the language but gives C programmer the advantages of not having to
program the same data structures over and over.

The proliferation of libraries that do the same thing WITHOUT a standard
in C means that each big project in C has several versions of the same
data structure because library XYZ uses lists with the "Next" field
in the fiorst position and library"XXX" uses a list with Next in the
second position. Besides all APIs are different, etc.

This is SO OBVIOUS that doesn't even need to be discussed. But C should
be kept in its present state so taht the only alternative is to swallow
C++

Well, you confirm everything that I said.
 
N

Nick Keighley

Rob Kendrick a écrit :




`Well, to deduce from this that C and C++ are "not compatible" is just
nonsense.

Yes, C++ has new (pun intended) keywords. If you avoid those
pitfalls they are compatible. Yes, there are other minor details
like that but I have never found a show stopper.

quite correct. This harping on about keywords is just silly. You can
write code that compiles with both and a C compiler and a C++
compiler. And it isn't that hard.
 
B

bartc

Casey Hawthorne said:
Peter Van Der Linden in "Expert C Programming - Deep C Secrets" 1994
and I imagine others have pointed out some of C's idiosyncrasies.
Has thought been given given to a cleaned up C? Possibly called C+.

That's exactly what I was thinking, when I first looked at using C around
'92**. Surely someone would have got round to tidying up the language by
then?

But people who use C seem to love it exactly the way it is.

And I'd imagine any replacement language created now, especially by
committee. would have it's own difficulties.

(** As it happened, I chose to develop my own language instead (it was
easier...). Creating a language that does pretty much what C does, is not
that difficult, more of a student exercise. However you then have to work
with something that is not mainstream and not compatible with anything else.
And that needs maintaining.)
 
I

Ian Collins

jacob said:
C is still being used, and many important projects are based on it. My
thesis is that a simple language is necessary and useful. Adding
a general and extensible container interface for C doesn't change at all
the language but gives C programmer the advantages of not having to
program the same data structures over and over.
>
The proliferation of libraries that do the same thing WITHOUT a standard
in C means that each big project in C has several versions of the same
data structure because library XYZ uses lists with the "Next" field
in the fiorst position and library"XXX" uses a list with Next in the
second position. Besides all APIs are different, etc.

One interesting question is why, after over 30 years of use, there
hasn't appeared a widely accepted a general and extensible container
interface for C?

The C++ STL appeared fairly early on in that language's evolution and
was rapidly and widely accepted by C++ developers. The widespread use
resulted in it being incorporated into the standard library in first
language standard.

Why hasn't the same thing happened with C?
 
T

Thomas Richter

jacob said:
Thomas Richter a écrit :
Given the amount of existing code that builds on the existing C
library, replacing it is actually plain nonsense.

Nobody is proposing that. This is an old trick in this discussions. Any
improvement to C is impossible because the old code. That is plainly not
true. The old code and the associated functions can be kept, but C
should be able to use BUFFERS of KNOWN length, avoiding the most common
cause of buffer overflows. Let's be explicit:

typedef struct {size_t length; char data[];} Buffer;

memset can be done as "Memset", for instance like this
bool Memset(Buffer *dest, int char_val);

memset already takes a byte count argument, why do I need another
function? In fact, memset is as safe as it gets.
This is an easy example. Strcpy is just as trivial, but with a character
buffer.

There is already a secure version of strcpy, see below.
This has been discussed and discussed, and the essential point is that
if somebody makes a mistaken once, it is his/her fault. Ifvthousands of
programmers make always the same errors it is the tool's fault.

Then C is not the right tool for the job. As said below, there are other
languages that can help. If you want to use C, there are also secured
functions with buffer sizes that help. But even they won't prevent you
from shooting yourself into the foot. C has no means to prevent bad
pointers being dereferences, to give another example. If you want a
child-proof C, use Java - it does have all the features you seem to
miss. (And no, I've absolutely nothing against Java, no irony here.)
I am sure you can be proved wrong too.

Of course I make mistakes, who wouldn't? And your point is? Again, if
"avoiding errors" is your concern, use another tool and make other
errors. Just that languages like java or C++ are neither the right tool
for *some* jobs.
Exactly. A better version would use COUNTED buffers!

There is a version, so use it. I don't understand your complaint. If I
use strcpy, then under controlled conditions where I do have control on
the input and the output buffer, as in allocating the output buffer from
the size of the input.

The problem is not strcpy, the problem is that C "string handling" is
considerably broken - for security aspects, but also for all kind of
string handling. It is just too low level. I don't have a problem with
that - if I do need to do massive string handling, I use other languages.
Here we have it again. Any development of C is always answered with
"Go to C++" even by committee members. C should remain full of warts
so that C++ can be seen as the only alternative. There should be NO
simpler language than C++, all development of C as a language should
STOP.

If you want ultimate security, *DO NOT USE C*. It is not the language
for that job. It is a low-level language. Buffer overruns are just *one*
of the problems of C. Pointers are another. Should we ban pointers from
C just because they can be used for dangerous tasks?
You are confirming what I say about committee members.

You don't understand the most basic rule: Use the right tool for the job.
Then, each C programmer needs to port a library that does lists,
flexible arrays, or find and debug one and port it, etc.

No, the programmer would rather need to look for a better tool for the
job. Writing pograms in C just to use C is a bad idea. Use a language
that offers such functionalities if you need them. Or use readily
available libraries if you want to - I'm sure you'd find plenty.
OF COURSE that is the solution.

Then where is the damn problem?
Yu are (again) confirming what I said:
All development in C should stop and we should swallow C++ if we want to
do the simplest tasks!

And why is that a problem?
If we want to use (portably) a list, we are forced to use C++ and
their STL...

Or any other language that offers that. Java, python, ....

I still don't see the problem.
C is still being used, and many important projects are based on it. My
thesis is that a simple language is necessary and useful.

Then keep it simple. If writing a list or a tree is not simple for you,
you are in the wrong field for applying C for that task. Or look for a
library that helps you. C is a small language; why whould that stuff be
required in the language core - it would often not fit into the
application because C doesn't have all the mechanisms of higher
languages to hide the implementation behind the design.
This is SO OBVIOUS that doesn't even need to be discussed. But C should
be kept in its present state so taht the only alternative is to swallow
C++

It's obvious that you want to use C just for the means of it. Get over
it, C is not the "saves all my problems" language. It is good in some
cases, and bad in others. String manipulation and generic container
support are not the strong parts of C, so why force it? If you want to
make C another language, I again ask why. There *are* already other
languages in first place you can use.

Greetings,
Thomas
 
J

jacob navia

Thomas Richter a écrit :
Then C is not the right tool for the job. As said below, there are other
languages that can help.
[snip]

Again, if
"avoiding errors" is your concern, use another tool and make other
errors.
[snip]

The problem is not strcpy, the problem is that C "string handling" is
considerably broken - for security aspects, but also for all kind of
string handling. It is just too low level. I don't have a problem with
that - if I do need to do massive string handling, I use other languages.
[snip]

If you want ultimate security, *DO NOT USE C*. It is not the language
for that job. such simple data structures in the standard.
Then, each C programmer needs to port a library that does lists,
flexible arrays, or find and debug one and port it, etc.

No, the programmer would rather need to look for a better tool for the
job. Writing pograms in C just to use C is a bad idea. Use a language
that offers such functionalities if you need them.
OF COURSE that is the solution.

Then where is the damn problem?
Yu are (again) confirming what I said:
All development in C should stop and we should swallow C++ if we want to
do the simplest tasks!

And why is that a problem?

[snip]


I still don't see the problem.

This is SO OBVIOUS that doesn't even need to be discussed. But C should
be kept in its present state so taht the only alternative is to swallow
C++

It's obvious that you want to use C just for the means of it. Get over
it, C is not the "saves all my problems" language. It is good in some
cases, and bad in others. String manipulation and generic container
support are not the strong parts of C, so why force it? If you want to
make C another language, I again ask why. There *are* already other
languages in first place you can use.

There is no point in discussing with you

Let's agree that we disagree, and go on using your pet language,
whatever that is.

My opinion is that C should be developed further, exactly BECAUSE is
a simple language. Adding a container library to C doesn't make the
language any bigger or more complicated but makes programs COMPATIBLE
because it is possible to interchange data with standard API/containers.

There is no way in C to return a list of the files in a directory. Nor
there is a standard way to return a flexible array, or similar
containers.

I have been developing a library like that, that is extensible and
patterned after the STL.The only difference is that is way faster and
smaller than the STL. I see that the C++ people will start crying that
that is an heresy of course.

You (and the other C++ avocates here) seem to believe that complexity is
better in sofwtare construction. My thesisis the opposite. I believe
that a simple language is better than a completely bloated like C++.
 
J

jacob navia

Ian Collins a écrit :
jacob navia wrote:

One interesting question is why, after over 30 years of use, there
hasn't appeared a widely accepted a general and extensible container
interface for C?

The C++ STL appeared fairly early on in that language's evolution and
was rapidly and widely accepted by C++ developers. The widespread use
resulted in it being incorporated into the standard library in first
language standard.

Why hasn't the same thing happened with C?

Because the C standards committee has always decided NOT to add such
an improvement to the language. The C++ standard committee decided that
such an improvement WAS NECESSARY, and they develop one.

I have written most of the STL clone (AVL trees, RB trees, bitstrings,
flexible arrays, lists (double/single linked) and the whole library
is extremely fast and compact. It is just less than 100K when you use
all of it. If you use just the lists module it is less than 5K.

But apparently all this work is a waste of time. The committee decided
a feature freeze already, and I will not be ready to present this to
the next meeting in April.
 
I

Ian Collins

jacob said:
Ian Collins a écrit :

Because the C standards committee has always decided NOT to add such
an improvement to the language. The C++ standard committee decided that
such an improvement WAS NECESSARY, and they develop one.

Not quite, the STL component of the C++ standard library (people often
overlook the fact that the STL is a component of and not the entire C++
standard library) was around before the standardisation effort.
I have written most of the STL clone (AVL trees, RB trees, bitstrings,
flexible arrays, lists (double/single linked) and the whole library
is extremely fast and compact. It is just less than 100K when you use
all of it. If you use just the lists module it is less than 5K.
the next meeting in April.

Make it publicly available and see how well it's used. You never know,
it might become popular enough for the new round of standardisation.
 
I

Ian Collins

jacob said:
My opinion is that C should be developed further, exactly BECAUSE is
a simple language. Adding a container library to C doesn't make the
language any bigger or more complicated but makes programs COMPATIBLE
because it is possible to interchange data with standard API/containers.
True enough. Languages tend to stand or fall depending on the quality
of their libraries these days.
There is no way in C to return a list of the files in a directory. Nor
there is a standard way to return a flexible array, or similar
containers.

Well there is, you just have to write one.
I have been developing a library like that, that is extensible and
patterned after the STL.The only difference is that is way faster and
smaller than the STL. I see that the C++ people will start crying that
that is an heresy of course.

Will they? I very much doubt it. They will probably ask to see some
examples and benchmarks. Your solution my well be faster, but you will
have had to make some trade-offs to gain the speed.
You (and the other C++ avocates here) seem to believe that complexity is
better in sofwtare construction. My thesisis the opposite. I believe
that a simple language is better than a completely bloated like C++.

Not really, but there are people here who are happy to use other
languages for tasks that better match their features.
 
I

Ian Collins

Branimir said:
I don;t think so. Widespread usage of STL was only after compilers
implemented templates to some workable extent,which is around year 2000.

Which was "fairly early" in C++ terms, well before the language was
standardised.
 
K

Keith Thompson

Ian Collins said:
Which was "fairly early" in C++ terms, well before the language was
standardised.

No, the first ISO C++ standard was published in 1998.
 
M

Michael Foukarakis

Peter Van Der Linden in "Expert C Programming - Deep C Secrets" 1994
and I imagine others have pointed out some of C's idiosyncrasies.
Has thought been given given to a cleaned up C?  Possibly called C+.

My apologies, but I'm unable to recall whole passages of text, and I'm
sure others are too. Could you be more specific? Which idiosyncrasies?
Are they syntactic, semantic? What are some good reasons to remove
them?
 
T

Thomas Richter

jacob said:
There is no point in discussing with you

Thus, "I'm running out of arguments", right? (-;
Let's agree that we disagree, and go on using your pet language,
whatever that is.

No, you completely miss the point. I don't *have* a pet language, unlike
you.
My opinion is that C should be developed further, exactly BECAUSE is
a simple language. Adding a container library to C doesn't make the
language any bigger or more complicated but makes programs COMPATIBLE
because it is possible to interchange data with standard API/containers.

There is no way in C to return a list of the files in a directory. Nor
there is a standard way to return a flexible array, or similar
containers.

Not in C, but in POSIX, which is implemented by most C compilers. This
is basically because the execution environment of some C compilers do
not have the notion of a directory. Actually, there are no means to do
the same in C++, and for the same reason.

If you need a container for a flexible array, write one - where's the
problem?
I have been developing a library like that, that is extensible and
patterned after the STL.The only difference is that is way faster and
smaller than the STL. I see that the C++ people will start crying that
that is an heresy of course.

Then you made other design tradeoffs; it depends on the problem whether
your solution fits the problem or not. Nobody will be crying either,
they'd probably ask you for the design tradeoffs you took. Nobody will
be arguing that the STL is the optimal solution for every problem, it
surely isn't. I'm not a big fan of the STL either, it is overweight, too
complex, and often doesn't do what I need, but that's a different topic
that has nothing to do with C.
You (and the other C++ avocates here) seem to believe that complexity is
better in sofwtare construction. My thesisis the opposite. I believe
that a simple language is better than a completely bloated like C++.

You still don't get it, don't you? I'm not a "C++ advocate". I'm a "use
the right tool for the job" advocate. That might be C, C++, java,
pyhton, bash, or whatever else is out in the field. For complex
algorithms on a desktop system, I wouldn't use C. Neither would I use
C++ for a GUI-intensive problem, java is much better suited for that,
nor would I write scripts in java, that's what I use python for.

Greetings,
Thomas
 
B

bartc

Michael said:
My apologies, but I'm unable to recall whole passages of text, and I'm
sure others are too. Could you be more specific? Which idiosyncrasies?
Are they syntactic, semantic? What are some good reasons to remove
them?

"Chaper 3. Unscrambling Declarations in C". A language shouldn't need
complicated algorithms just for making sense of type specifications.

There is also the business of having separate typedef names and struct
names:

struct point {int x,y;};
typedef struct point point;

struct point p;
point q;

And the typedef statement itself, which instead of having the type-spec on
one side, and the alias for it on the other, is all mixed up:

typedef int tenvector[10];

the typedef name is in the middle of the type-spec!

This is one area I've always had (and always will have) problems with. I'm
sure the OP and the book had many others in mind too.
 
E

Eric Sosman

"Chaper 3. Unscrambling Declarations in C". A language shouldn't need
complicated algorithms just for making sense of type specifications.

(Shrug.) Nonetheless, the power to derive new types from
the built-in types is desirable. What's your suggestion for a
simplification that retains the same expressive power? Show us
the declaration of, say, signal() in your simplified scheme.
There is also the business of having separate typedef names and struct
names:

struct point {int x,y;};
typedef struct point point;

struct point p;
point q;

This is, at most, a minor point (sorry), and IMHO not worth
addressing. Indeed, the cure might be worse than the disease:

struct point { int x, y; };
struct point point(int x, int y) {
struct point p;
p.x = x;
p.y = y;
return p;
}

A rule that automatically made a struct tag a first-class type
name (and perhaps similarly with union and enum tags, too) would
forbid this style of naming con-struct-ors.
And the typedef statement itself, which instead of having the type-spec
on one side, and the alias for it on the other, is all mixed up:

typedef int tenvector[10];

the typedef name is in the middle of the type-spec!

Er, um, yes. What's your point?
This is one area I've always had (and always will have) problems with.

Yes, we can see that. Be patient: Facility comes with
familiarity, and familiarity with practice.
I'm sure the OP and the book had many others in mind too.

... which takes us all the way back to Michael Foukarakis'
question: What, specifically, are the idiosyncracies that bother
you? (Beyond your difficulties in understanding declarations,
which will, as I said, smooth themselves out with practice.)
 
B

bartc

Eric Sosman said:
(Shrug.) Nonetheless, the power to derive new types from
the built-in types is desirable. What's your suggestion for a
simplification that retains the same expressive power? Show us
the declaration of, say, signal() in your simplified scheme.

I proposed a simplified scheme for C here a couple of years back. I haven't
got a message ID, but a similar one, adapted from another language might be:

T Type T
[N] T N-element Array of T
* T Pointer to T
function (A,B,C)T Function taking params A,B,C and returning T

I don't know the spec of signal(), but an array of pointers to a function
taking two ints and returning a pointer to a double, might be:

[]*function(int,int)*double

Notice the 1:1 correspondence with the English.
....
This is, at most, a minor point (sorry), and IMHO not worth
addressing. Indeed, the cure might be worse than the disease:

struct point { int x, y; };
struct point point(int x, int y) {
struct point p;
p.x = x;
p.y = y;
return p;
}

A rule that automatically made a struct tag a first-class type
name (and perhaps similarly with union and enum tags, too) would
forbid this style of naming con-struct-ors.

I'm not sure about your point: are you saying being able to write the above
is good or bad?
And the typedef statement itself, which instead of having the type-spec
on one side, and the alias for it on the other, is all mixed up:

typedef int tenvector[10];

the typedef name is in the middle of the type-spec!

Er, um, yes. What's your point?

It's, um, untidy. I have chosen one of the 3 type-declarations I do know
(ie. simple type, pointer, and array), in a more complicated one you have to
search for the name of the typedef!

(Elsewhere I might write the above as:

type tenvector = [10]int

Note the name always goes in the same place and does not have to be
extricated.)
Yes, we can see that. Be patient: Facility comes with
familiarity, and familiarity with practice.


... which takes us all the way back to Michael Foukarakis'
question: What, specifically, are the idiosyncracies that bother
you? (Beyond your difficulties in understanding declarations,
which will, as I said, smooth themselves out with practice.)

A bit like learning Chinese symbols. On the other hand, it might be a lot
easier to start with pin-yin.

The very existence of that chapter, and programs such as CDECL, show I'm not
alone in my difficulties.
 
J

jacob navia

Lorenzo Villari a écrit :
What does it means "GUI-intensive" and why should java be better at
solving these kinds of problems? Excluding subjective aesthetic
consideration on the resulting GUIs, I think some operations
"could" (but I'm unaware of recent changes so I could be wrong) be a bit
slower than an analogous C or C++ counterpart. Of course if maximum
speed is not required that's ok. A slow menu is not that cool btw...

For an example of a full C only program using advanced GUI features
see the lcc-win debugger.

The debugger+IDE+Project management+Editor+grep+diff+reformater+etc
is just 800K (windows 32 bit).

Only C allows you the speed AND power of direct GUI access with access
to the low level debugging API.
 
I

ImpalerCore

    (Shrug.)  Nonetheless, the power to derive new types from
the built-in types is desirable.  What's your suggestion for a
simplification that retains the same expressive power?  Show us
the declaration of, say, signal() in your simplified scheme.

I proposed a simplified scheme for C here a couple of years back. I haven't
got a message ID, but a similar one, adapted from another language might be:

T                  Type T
[N] T              N-element Array of T
* T                Pointer to T
function (A,B,C)T  Function taking params A,B,C and returning T

I don't know the spec of signal(), but an array of pointers to a function
taking two ints and returning a pointer to a double, might be:

[]*function(int,int)*double

Notice the 1:1 correspondence with the English.




...
    This is, at most, a minor point (sorry), and IMHO not worth
addressing.  Indeed, the cure might be worse than the disease:
struct point { int x, y; };
struct point point(int x, int y) {
    struct point p;
    p.x = x;
    p.y = y;
    return p;
}
A rule that automatically made a struct tag a first-class type
name (and perhaps similarly with union and enum tags, too) would
forbid this style of naming con-struct-ors.

I'm not sure about your point: are you saying being able to write the above
is good or bad?


And the typedef statement itself, which instead of having the type-spec
on one side, and the alias for it on the other, is all mixed up:
typedef int tenvector[10];
the typedef name is in the middle of the type-spec!
    Er, um, yes.  What's your point?

It's, um, untidy. I have chosen one of the 3 type-declarations I do know
(ie. simple type, pointer, and array), in a more complicated one you have to
search for the name of the typedef!

(Elsewhere I might write the above as:

type tenvector = [10]int

Note the name always goes in the same place and does not have to be
extricated.)


    Yes, we can see that.  Be patient: Facility comes with
familiarity, and familiarity with practice.
    ... which takes us all the way back to Michael Foukarakis'
question: What, specifically, are the idiosyncracies that bother
you?  (Beyond your difficulties in understanding declarations,
which will, as I said, smooth themselves out with practice.)

A bit like learning Chinese symbols. On the other hand, it might be a lot
easier to start with pin-yin.

The very existence of that chapter, and programs such as CDECL, show I'm not
alone in my difficulties.

You have a huge amount of inertia present in the C language and
syntax, and I believe that these syntax arguments are pretty much
pointless most of the time. Preferences I think you can argue over,
but with no compiler support for these syntax changes, it's not like I
can try out your version and see if I think it's better.

Contrast this with something like 'const char*' versus 'char const*';
that's something that I can at least try out.

Best regards,
John D.
 

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
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top