2
2005
Would it suppress errors?
Is he trying to hide errors in his code?
Is he trying to hide errors in his code?
Would it suppress errors?
Is he trying to hide errors in his code?
2005 said:Would it suppress errors?
Is he trying to hide errors in his code?
Probably the reverse, C++ and its compilers are more pedantic about a
number of issues, particularly type safety.
Do bear in ming there are sometimes obscure semantic differences between
the two languages, so you would be ill advised to try this at home
unless you are aware of the risks.
Then the code is more than likely C like C++, not C.I tried this code on "cc -c" - it gave numerous errors
But non when I did g++ on a C code
Is this a good practice to compile a C code with g++ compiler.
Don said:A C++ compiler *IS*, by definition, a C compiler. PLUS some stuff.
In general, unless you're trying to compile C++ code (in which case, a
"plain C" compiler just can't cope) it really doesn't much matter if you
use a "plain" C compiler, or a C++ compiler on a straight C source.
Don said:A C++ compiler *IS*, by definition, a C compiler. PLUS some stuff. And
generally, it's even pickier than its "plain C" counterpart. So no, it's
not likely to suppress errors. If anything, it's more likely to complain
even MORE about errors than a "plain" C compiler would.
2005 said:Would it suppress errors?
Is he trying to hide errors in his code?
Richard said:/* Please convert this program to C++ using the
* following rules:
So after renaming identifiers, a C++ compiler gave similar errors:(Incidentally, this program also demonstrates that C99 isn't a superset of
C90.)
Read them again "implicit function declaration". Your forgot <ctype.h>Richard said:Ian Collins said:
A copyo, perhaps? It compiles just fine here, under the strictest set of
flags I can summon up.
Neither of these diagnostic messages is mandatory: implicit int is legal in
C...
....except, of course, when it isn't.
It demonstrates what we already know - i.e. that C++ compilers can't
compile C programs.
Now where did I leave my Tardis?Richard said:Ian Collins said:
No, I didn't. I just mis-typed "implicit function declaration".
Implicit function declaration is, of course, legal in C90 (C).
A C++ compiler *IS*, by definition, a C compiler.
> The above is complete nonsense. It is unbelievable that someone
> who knows so little can write so much with a presumed air of
> authority. Until we see evidence that Don Bruder has learned
> something, it is safer to ignore him. For example.
On Apr 7, 9:56 pm, 2005 <[email protected]> wrote:
He is using g++ on a *.c code!
Also what is so different between gcc & cc compiler - any advantages?
<OT>
On Apr 7, 9:56 pm, 2005 <[email protected]> wrote:
[Subject: Why would someone use c++ compiler on a C code?]He is using g++ on a *.c code!
g++ will act as a C compiler when given the file 'foo.c', unless you
specifically ask it to do otherwise.
gcc will always give you the GNU C compiler, unless the system was
deliberately set up to be confusing and/or broken.
Actually that idiom was retained, reluctantly, to avoid breaking reams
of legacy code, as committee members have informed us in previous posts
to this ng.
Actually that idiom was retained, reluctantly, to avoid breaking reamsKelsey Bjarnason said:[snips]
A C++ compiler *IS*, by definition, a C compiler.
#include <stdlib.h>
int main(void)
{
char *s = malloc(100);
if ( s ) free( s );
return 0;
}
gcc -Wall -ansi -pedantic test.c compiles clean. Note the use of the
proper C idiom of *not* casting the return of malloc, which is both
intentional and correct.
of legacy code, as committee members have informed us in previous posts
to this ng.
One effect is that if used in new code, the program will no longer
compile under C++.
The above is complete nonsense. It is unbelievable that someone who
knows so little can write so much with a presumed air of authority.
Until we see evidence that Don Bruder has learned something, it is safer
to ignore him. For example.
this is obvious bullshit.
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.