C
CBFalconer
Chris said:For once we agree completely! BTW Ditto for his C++ books
Migawd. Two millenia within 8 years!
Chris said:For once we agree completely! BTW Ditto for his C++ books
According to its author it was when he started.
Final Note: Why is the compiler called QuickC ? I think perhaps because it
allows you to quickly type any C program
without proper headers and declaration and yet produce some answer.
...ish. Whenever I call malloc, for example, I am writing a C program that
is not a legal C++ program. I could make it a C++ program, but only by
damaging the C code. As written, it is not C++. And quite a few of my
programs call malloc.
Al Balmer said:The Preface to the first edition of "The C++ Programming Language"
says "except for minor differences." The second edition notes that
language changes have been made "to increase C compatibility." It was
never a superset.
CBFalconer said:If that is the H Schildt (sp?) book, you are lucky. You have now
been advised that it is useless and stuffed full of errors, because
the author doesn't understand C. See if you can get some practical
use of it as a replacement for a log in the fireplace.
That makes more sense. For early C++ to have been a true superset of
C, it would have had to have no additional keywords; I doubt that a C
program using "class" as an ordinary identifier was ever a valid C++
program. (I'll grant that such things are "minor differences".)
Richard Heathfield wrote:
...
You're right, the preferred way to handle calls to malloc() in C code
doesn't work in C++. However, I wouldn't prcall the changes required
to allow it to compiile in both languages "damage". The result is
legal C as well as legal C++. It's just less than ideal for C. That
just balances things: almost any use of malloc() is less than ideal
for C++.
Not bad as a door stop either...
QuickC was one of the earliest "all in one" programming platforms,
similar to Borland's Turbo C. It provided an IDE, "instant"
compilation and error reporting, execution, and debugging. It was
"quick" compared to the old edit, repeat(compile), link, test cycle.
Nick Keighley said:ie. it makes no sense.
and isn't "type" a C++ reserved word?
![]()
no, it isn't a macro.
Jack Klein schrieb:
I didn't write this code, but what is wrong about it?
In 'C: the complete reference' all prgs start like that.
Is x++ not the same as x=x+1?
QuickC didn't complain.
lcc-win32 prints lots of warnings.
Warning test.c: 3 old-style function definition for 'main'
Warning test.c: 3 missing prototype for 'main'
Warning test.c: 3 'void main()' is a non-ANSI definition
Warning test.c: 6 missing prototype for printf
Warning test.c: 6 Missing prototype for 'printf'
0 errors, 5 warnings
What do they mean?
Warning test.c: 3 'void main()' is a non-ANSI definition
Warning test.c: 3 missing prototype for 'main'
Warning test.c: 3 old-style function definition for 'main'
Why are there 2 warnings on line 6?
Some of them go away with #include <stdio.h>.
But where is the prototype for main()?
With MS QuickC and GCC it prints 6.
With lcc-win32 it prints 5.
But gcc says 'operation on x may be undefined'.
I'll have to investigate why.
I can't!
It is required for an advanced class.
I don't think that's gonna work.
He is a cousin of the principal.
Chris said:According to its author it was when he started.
Things move C++ was based on C89 since then noth C and C++ have moved
in different directions.
In the beginning C++ was a superset of C otherwise they could not have
used the C++ compiler for initial testing and then a C compiler for
final testing,
I didn't realize anyone still ran it until it came up in this thread.
How about an answer straight from Stroustrup's FAQ instead. He answers
the question, and if anyone is qualified to do so, he probably fits the
bill:
http://www.research.att.com/~bs/bs_faq.html#C-is-subset
That section of his FAQ, and the several after it call out quite a few
reasons that perhaps don't agree with the notion that C is a subset of
C++ in any meaningful way to programmers.
If that isn't sufficient, this might prove helpful as well:
http://david.tribble.com/text/cdiffs.htm
It enumerates a painfully long list of differences between ISO C and
ISO C++.
Randy Howard wrote:
...
I interpret that section in almost exactly the opposite fashion. He ends
the section by saying "Except for a few examples such as the ones shown
above ... C++ is a superset of C.".
Despite the length of that list, it's no serious constraint on a C
programmer to write code that performs identically whether its compiled
in C90 or in C++98.
Writing code that uses features that were new in C99 is trickier. C99
added some features that improved C++ compatibility (// comments,
digraphs, <iso646.h>, and mixing statements with declarations), but
added many other new differences. That's because the C++98 standard was
completed a year before the C99 standard. Future versions of the C++
standard will incorporate many of the features that were added to C in 1999.
James said:.... snip ...
Writing code that uses features that were new in C99 is trickier.
C99 added some features that improved C++ compatibility (//
comments, digraphs, <iso646.h>, and mixing statements with
declarations), but added many other new differences. That's
because the C++98 standard was completed a year before the C99
standard. Future versions of the C++ standard will incorporate
many of the features that were added to C in 1999.
Randy Howard said:We'll have to wait and see, not to mention whatever C0x does to muddy
up the waters again. That said, since C99 isn't readily available in
compilers (real support, not bits and pieces), it will take a miracle
by the C committee to make anyone adopt any more changes if they are
perceived as unnecessary as that batch from 99.
And if gets() isn't completely deprecated this time, I'll know they're
just pulling my leg anyway.![]()
1. in the prg bellow what vars are stored on stack, heap, data segment?
int i;
void main()
{
int j;
int *k = (void *)malloc(1);
}
(I think j and k are on stack, but where is i?)
pps: Is very urgent!
Randy said:We'll have to wait and see, not to mention whatever C0x does to muddy
up the waters again. That said, since C99 isn't readily available in
compilers (real support, not bits and pieces), it will take a miracle
by the C committee to make anyone adopt any more changes if they are
perceived as unnecessary as that batch from 99.
And if gets() isn't completely deprecated this time, I'll know they're
just pulling my leg anyway.![]()
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.