# Is clang/llvm C/C++ different then gcc C/C++.



## Alain De Vos (Sep 4, 2022)

Some ports compile fine with clang/llvm other with gcc.
Is C/C++ not a standard or did i miss something.


----------



## zirias@ (Sep 4, 2022)

Yes.


----------



## mer (Sep 4, 2022)

Yes, they are different.  C/C++ is standardized, but every compiler since Borland C++ 1.0 has has extensions that some Makefiles will take advantage of.  If you build with default options it shouldn't matter what compiler.

Basically:
c++ -o blah blah.cpp

should work if c++ is clang or g++

Starting to do:
c++ -O3 -fblahblahblah  
you're going to run into differences.

Sorry, more characters to say the same thing as zirias@


----------



## icodeforyou (Sep 4, 2022)

Not every compiler supports every feature of a certain C/C++ standard all of the time.

You can check this here for C++ for example: https://en.cppreference.com/w/cpp/compiler_support

But it is quite a lot of things to check

Edit: It turns out others were faster on this one


----------



## mer (Sep 4, 2022)

icodeforyou said:


> Edit: It turns out others were faster on this one


"I hate it when that happens because it happens all the time"

It's a good lesson to make sure you only compile/build with standard options and pay attention to all warning and other messages from a compiler.  I like "-Werror" it often results in better code.


----------



## Crivens (Sep 4, 2022)

Plum Hall had a C++ parser we were about to use but culdn't afford. I read the documentation about the differences w.r.t. gcc/VC++/Borland/... and was in despair. Cray used PH as a parser/front end for their compilers, that was where I had my first contact with them. Boy, that thing was picky...


----------



## mer (Sep 4, 2022)

Plum Hall.  Blast from the past.  Early days of C++ were weird


----------

