Void Main?

S

spinoza1111

C constitutes a subset of C++.

[...]

"spinoza1111" is mistaken.  C is *nearly* a subset of C++, andWangYiphas found one of the areas of inconsistency, namely the meaning
of empty parentheses in a function declaration.

C is a subset of C++ not mathematically (it is a vicious illusion that
something so subject to vendor greed is a mathematical object) as a
matter of understanding. A "fuzzy" subset. One of these days, Kiki,
you might get up to my more nuanced understanding. But I won't bet on
it.
 
S

spinoza1111

I really do find it amazing that people can consider themselves experts
when they don't even know the name of the language they are programming in.

Wang Yip does know the name. The problem is that C as an artifact is
yapped about by people in a self-interested way so as to destroy
reputations. You people don't write code, in all probability.
Not knowing the difference between the two languages makes it impossible
to believe he's worked on any significant C project. If he tried he
would just end up wondering why his code did not compile.

He uses both languages, probably more intensely than anyone else
here.
Yes, he's even got the wrong country. I'm one of the British Imperialists....

....who started the brutalization of China by stealing territory and
destroying an ancient cultural monument, the Summer Palace...
He also needs to learn which language is which. Without that knowledge
he won't get very far. Without improving his English he will also find
it hard to deal with requirement specifications written in English (or
American) which will also limit him (if you can't understand the

Understanding English is a separate skill from writing, and he writes
reasonable Chinglish. As the manager of a Chinese/English translation
group in the mainland I didn't have to master Chinese because the
technicians produced reasonable Chinglish documents which I was able
to transform to contemporary business English.

requirement spec, you can't design, and requirements often use the
language in fairly sophisticated ways). Mind you, I would stand no
chance of getting a job in a non-English speaking country (or where
documentation was primarily written in another language) because I would
not sand a chance of getting any proficiency in another language.

Yes, and before you try that, you need to improve your English:

(1) "sand" a chance

(2) Not "getting any proficiency": "becoming proficient"

 
S

spinoza1111

spinoza1111 said:
C constitutes a subset of C++.
[...]
"spinoza1111" is mistaken.  C is *nearly* a subset of C++, andWang
Yiphas found one of the areas of inconsistency, namely the meaning
of empty parentheses in a function declaration.

I believe you'll find that, since this difference has actually affected a
poster to the newsgroup, that it is part of a global conspiracy against
Herbert Schildt.  Clearly, a dire circumstance, when language features
are designed in the late 80s precisely to make naive readers think Spinny
doesn't know what he's talking about, when in fact, he understood both
languages quite well until time-travelling anti-Schildt conspiracy
theorists went back to the 1980s and introduced the incompatibility.
To the ignorant, "conspiracy theory" and knowledge are easily
confused. You attacked Herbert Schildt, saying among other things that
"the 'heap' is a DOS term" without academic training in computer
science. It wasn't a conspiracy, just a fact.
 
S

spinoza1111

C constitutes a subset of C++.

[...]

"spinoza1111" is mistaken.  

You keep saying you'll ignore me. Why do you continue to break your
committments?


C is *nearly* a subset of C++, and Wang
Yip has found one of the areas of inconsistency, namely the meaning
of empty parentheses in a function declaration.

By saying emphatically using "differently" unnecessarily, you imply
that C and C++ are not dialects with respect to each other such that
some C programs can be compiled by C++ compilers (in fact, most C
programs can be compiled by C++ compilers).

But since most C++ compilers can compile C, C is as a practical matter
a subset of C++.

You seem unaware that while it may seem scientific to treat "C" and "C+
+" as simple objects without parts and as part of nature, they are
complex objects with many moving parts and a social construct. This
means as a practical matter that Wang Yip is probably using, and
expert in, both languages as a real programmer, as opposed let us say
to a person (Seebs) who's never taken a computer science class and
apparently mostly writes shell scripts, or a Nokia manager-programmer
who's probably too "valuable" to code in the sense that he's overpaid.

Microsoft C supports almost all forms of C within C++, and because
Windows is competently written, you can return from main without
fearing you'll break anything; the void main nonsense was probably the
result of greedy vendors who've laid off competent compiler people in
favor of script kiddies without formal training in CS, and the script
kiddies would run home to Mommy's basement if they had to modify the
vendor OS to not break when returned something strange. But that's
just speculation, of course.

It's very hard in my direct experience in mainland China and Fiji for
developers to get their hands on a range of computer books including
books that clarify the mess that was made of C99. Instead, they work
24/7 reverse engineering their compilers and of necessity they treat
their compilers as definitive.

This means that they are more and not less competent for the same
reason Dave Hanson told me at Princeton that he felt that Cobol
programmers, who also must make a silk purse out of a sow's ear, are
competent.

Wang Yip, in short, doesn't sit around with the guys at the office
sniggering about Nilges or Schildt. He should be treated with respect.
 
S

spinoza1111

Welcome back. Hope you had a nice holiday (mean that: "keep your
friends close, keep your enemies closer" - Sun Tzu)
In <[email protected]>,

spinoza1111wrote:
spinoza1111<[email protected]> writes:
C constitutes a subset of C++.
[...]
"spinoza1111" is mistaken.
You keep saying you'll ignore me. Why do you continue to break your
committments?

What commitment? He replies to whom he will. So do I. So do you.

Which means his committments to bind himself, like those of your
Parliament, cannot be trusted, whereas I am more like our Congress,
able to bind myself under a written Constitution.
Not always with identical semantics. This is trivial to demonstrate.
It is even more trivial to demonstrate an example of a legal C
program that is not a legal C++ program. For your claim about C being
a subset of C++ to be true, *all* legal C code would have to be legal
C++ code, and it isn't, so it isn't.

No, not "all". C and C++ are dialects with respect to each other
because there is C code that isn't C++, C++ code that isn't C, and
code that's both (trivial example: "i = 0;"). But one language (C++)
is larger therefore may be considered a fuzzy superset.

Furthermore, and from a standpoint of formal language theory, there
exists the union of C and C++, trivially, the set of all possible
valid programs in C and C++. Wang Yip appears to have mastered this
nameless superset on the job, which is more than I can say for some
people here.

The problem is mastering the nameless union, for all platforms, and I
have yet to see someone with sufficient intelligence, vendor
independence, and maturity to write a book about C/C++ that doesn't
whine about the "proper" way to return to the OS or promote his
favorite (Microsoft or the complement set) vendor's interests. If such
a book exists, lemme know.

C++ compilers compile C++. If a program offers compilation under C
rules, it is a C compiler. If it offers compilation under C++ rules,
it is a C++ compiler. If it offers compilation under both languages,
it is a compiler for both languages. The fact that GCC can compile
Fortran does not make C++ a subset of Fortran.

No, it means that GCC supports a union of C++ and Fortran. For what
earthly reason I do not know. The relationship between C and C++ is
much closer, because as a general law, all competent programmers take
one look at C and say "gee, I could do better than that", and develop C
++, awk, grep, shep, blarg...anything not to have to program in C.

<nonsense snipped>

Don't cut yourself.
 
S

spinoza1111

spinoza1111wrote:
Which means his committments to bind himself [...]  cannot be trusted,

No, it doesn't. It means that he replies to whom he will. He can
voluntarily refrain from replying for a time without giving up the right
  to reply later on.

Yes, and it means that he has no self-discipline.
[...] some C programs can be compiled by C++ compilers (in fact, most C
programs can be compiled by C++ compilers).
Not always with identical semantics. This is trivial to demonstrate.
It is even more trivial to demonstrate an example of a legal C
program that is not a legal C++ program. For your claim about C being
a subset of C++ to be true, *all* legal C code would have to be legal
C++ code, and it isn't, so it isn't.
No, not "all". C and C++ are dialects with respect to each other
because there is C code that isn't C++, C++ code that isn't C, and
code that's both (trivial example: "i = 0;").

And therefore neither is a subset of the other.

Not in the literal sense, no. But part of being smart dear boy is
latitudinarianism as opposed to fundamentalism, neither of which
should be confused with antidisestablishmentarianism.

When you say "C is NOT C++" you're not an educator, but a sort of
ranting preacher who's no friend of knowledge.
With the added qualifier (but not without it) the statement is correct.

Good show.
Wrong. That is the intersection of C and C++. The union of C and C++ is
the set of all programs that are valid in either C or C++ or both.

Oh dear. You misunderstand, or I misspoke. "And" was not used to mean
formal logical intersection. The statement was shorthand for "the set
of all possible programs in C AND the set of all possible programs in C
++.
 > Wang Yip appears to have mastered this


It is evident from his articles that he has mastered neither language.
That is not a criticism of him, however; very few people have mastered
C, and fewer still have mastered C++.

The type of "mastery" of which you speak is a sort of Scholasticism
which good programmers ignore. As I have pointed out, the usual
reaction of a good programmer to C is to use it to replace having to
actually code in C.
That, at least, is true.


Presumably so that people can use GCC to write Fortran programs as well
as C and C++ programs.

Wow, some people are gluttons for punishment.
 
S

spinoza1111

Hey, you forgot to apologize for lying about my presence on
comp.risks. Just thought I'd remind you.
spinoza1111wrote:

<personal attack snipped>

I guess a person who only knows how to damage people online doesn't
recognize how everything he posts is a personal attack.
[...] because there is C code that isn't C++, C++ code that isn't C, and
code that's both (trivial example: "i = 0;").
And therefore neither is a subset of the other.
Not in the literal sense, no.

Precisely.

When you say "C is NOT C++" you're not an educator, but a sort of
ranting preacher who's no friend of knowledge.

Rubbish. The distinction is vital in the real world.

Actually, that's not true. You can use the compiler either way and if
your solution works it doesn't matter whether or not you use C++ or C.
Either way, owing to the common deficiencies of both languages, you've
created something that's significantly less reliable than C Sharp or
Java INDEPENDENT of your "good style", because under software
maintenance it becomes something different, something which you cannot
control.

Had you got it right in the first place, there would have been no cause
to correct you. Still, at least we have reached *one* point of agreement.

If it pleases you to fantasize you're teaching me a goddamn thing,
knock yourself out.
Actually, I can accept that you meant that.

My goodness, we are full of good cheer. Next thing, you will apologize
for lying about my presence on comp.risks. I look forward to reading
your retraction.
It is surprisingly difficult
to ensure that one's text is always so unambiguous as to yield no
reasonable interpretations except the intended one. I am occasionally
surprised by the meanings people ascribe to my own writings, that are
completely different to what I actually intended.

Wow. The light dawns. Praise Jesus!
No, the type of mastery of which I speak includes (but is by no means
limited to) basic knowledge of the language. A programmer who has never
encountered the void type in a prototype has not yet had sufficient
experience of the C language to justify a claim to mastery of that language.

Not so. He may exist in a disciplined development environment where
the type isn't used. The question is whether he can crank code in a
reliable way, and based on my experience with developers in mainland
China leads me to believe that Wang Yip can. As I have said,
programming skill is independent of knowledge of minutiae and
shibboleths.

Indeed, in a competent development environment, you'd never see the
need for "sequence points" since people would think through the
implications of expressions. Therefore, these developers would be
innocent of evil, like Adam and Eve, but would be more productive &
skilled.

 > As I have pointed out, the usual


This is not an advocacy group. If you don't like C, nobody is forcing
you to use it.

Opinions on C are on-topic here. If I can prevent one newbie from
being turned into the sort of programmers I see here, I am doin' good.
 
T

Tim Rentsch

Strictly speaking, void is not an identifier. Main, main, and Void
are, though.

Strictly speaking, void is an identifier. In phases 7 and
8, it is (either also, or instead) a keyword.
 
K

Keith Thompson

Tim Rentsch said:
Strictly speaking, void is an identifier. In phases 7 and
8, it is (either also, or instead) a keyword.

My reading is that void is an identifier (a kind of
preprocessing-token) in translation phases 3 through 6. In phase 7,
it's converted from a preprocessing token to a token; at this point,
it is a keyword and *not* and identifier.

void certainly meets the syntax of an identifier, but not the
semantics. See C99 6.4.2.1p2:

An identifier is a sequence of nondigit characters (including the
underscore _, the lowercase and uppercase Latin letters, and other
characters) and digits, which designates one or more entities as
described in 6.2.1.

void does not designate any of the entities described in 6.2.1. See also
6.4.2p4:

When preprocessing tokens are converted to tokens during
translation phase 7, if a preprocessing token could be converted
to either a keyword or an identifier, it is converted to a
keyword.

Not that it matters a great deal. The standard could have made
keywords a subset of identifiers, even in phase 8, while still
describing the same language (though some reference to identifiers
would have to be changed to "identifiers other than keywords").
 
A

Antoninus Twink

My reading is that void is an identifier (a kind of
preprocessing-token) in translation phases 3 through 6. In phase 7,
it's converted from a preprocessing token to a token; at this point,
it is a keyword and *not* and identifier.

void certainly meets the syntax of an identifier, but not the
semantics. See C99 6.4.2.1p2: [snip]
void does not designate any of the entities described in 6.2.1. See also
6.4.2p4:

Thanks so much for clearing that up, Keith.

This important question has been gnawing away at my peace of mind for
some months now, but at long last I'll be able to sleep easy tonight
knowing that it's been resolved.
 

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
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top