Differences between 'const char' and 'char'

R

Richard Bos

E. Robert Tisdale said:
Yes, but the ANSI/ISO standards documents are *not* Holy Scripture --
they are not even a dictionary of the English language.

The Highway Code is not holy scripture, either, but you'd better keep to
it when on the road.
Your attitude reminds me of an olde tyme preacher

And your attitude reminds me of those guys who claim they can drive at
murderous speeds "because the road is clearly suited to it".

Richard
 
H

hokiegal99

E. Robert Tisdale said:
Statements are *terminated* with a semicolon ;

This is what I've been taught. That's why I said that these
are statements:

const char filename[] = "ips_c.txt";
char filename[] = "ips_c.txt";

Maybe we're being too anal about this. Maybe we all need to get a life.
 
C

Chris Dollin

E. Robert Tisdale wrote:
A declaration is a statement.
An executable statement is an imperative.

C doesn't define that term: it's part of the informal meta-language,
not part of C. You are, sadly, wrong. What's more, in C, declarations
are also imperative - so that term doesn't distinguish a declaration
from a statement. Furthermore, there are C statements that are not
imperative (and not declarations).
Your attempt to narrow these definitions is anal.

No - it's a natural consequence of working in a specific domain.
It doesn't contribute anything except confusion.

I don't think anyone else but you was confused about this.
 
R

Richard Heathfield

Ben said:
C99 *is* an ANSI standard.

Just for the sake of completeness:

In 1999, ISO ratified ISO/IEC 9899:1999 as a replacement for ISO/IEC
9899:1990. It was not until 2000 that ANSI adopted this standard, so I
suppose we ought really to say that C99 is an ISO standard, and C2000 (or,
for those who have already forgotten Y2K, perhaps C00) is perhaps a more
accurate name for the new ANSI standard. (They are, however, effectively
the same standard, so IMHO Ben was quite within his rights to say that C99
is an ANSI standard. I am expanding his statement, rather than correcting
it.)

Implementors' uptake for this new standard has been slow. For maximum
portability, C programmers would be well advised to work within the common
subset of C90 and C99 as far as possible.
 
J

j

Richard Heathfield said:
Just for the sake of completeness:

In 1999, ISO ratified ISO/IEC 9899:1999 as a replacement for ISO/IEC
9899:1990. It was not until 2000 that ANSI adopted this standard, so I
suppose we ought really to say that C99 is an ISO standard, and C2000 (or,
for those who have already forgotten Y2K, perhaps C00) is perhaps a more
accurate name for the new ANSI standard. (They are, however, effectively
the same standard, so IMHO Ben was quite within his rights to say that C99
is an ANSI standard. I am expanding his statement, rather than correcting
it.)

It is noted on the ANSI webstore that c99 is formerly known
as ISO/IEC/ANSI 9899:1999 and is now known as
ISO/IEC/INCITS 9899:1999

So referring to it as ANSI is not entirely correct
Even though INCITS operates under ANSI
it would be more correct to refer to the actual groups
that are responsible for the standard.
Which is: ISO/IEC/INCITS
 
J

Jeremy Yallop

[crosspost added]

Micah said:
At this point, it's worth pointing out that certain *other*
similar changes were *not* made; for example:

while (int c = getchar())
...

Is still illegal in C.

It's valid C++, though (as is "if (int c = getchar())" etc.). Were
these additional changes considered and rejected by the committee, or
simply not considered at all? I suspect that the "for" version was a
common extension before C99 and the others were not. (Admittedly,
they appear to be more useful in C++, where they can be used in
conjunction with conversion operators to bool (etc.) and to support
the RAII idiom).

Jeremy.
 

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

No members online now.

Forum statistics

Threads
474,083
Messages
2,570,591
Members
47,212
Latest member
RobynWiley

Latest Threads

Top