On Tue, 2 Aug 2016 02:04:13 +0000 (UTC)
"Amadeus W.M." <amadeu...@verizon.net> wrote:

[snip] 
> 
> That's what I thought too, but try this: 
> 
> // Compile as 
> // g++ -o gnuc gnuc.cpp                      
> // then as 
> // g++ --std=gnu++11 -o gnuc gnuc.cpp
> 
> #include <iostream>
> #include <cstdlib>
> 
> using namespace std;
> 
> int main(int argc, char * argv[])
> {
>     cout << __GNUC__ << "." << __GNUC_MINOR__ << endl;
>     return 0;
> }
> 
> 
> It always outputs 6.1, whether or not you compile it with the --std
> flag. And if you think about it, __GNUC__ is probably a macro defined
> in the compiler at compile time, so it can't possibly change at run
> time. Haven't checked, but it's a good guess.

Yes, that makes sense.  But I don't think it means that it hasn't
made the compile adhere to the different standard.

Using a later compiler on earlier code is not optimal, that's for
sure.  And you're right, it's hard to trust that any executable under
that circumstance is functioning correctly, since it could introduce
subtle bugs.  For example, firefox had some serious problems with gcc6
because it changed the way the compiler treated certain constructs of
C++ in the latest standard.  What had been perfectly valid code became
invalid under the new rules.
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://lists.fedoraproject.org/admin/lists/users@lists.fedoraproject.org
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org

Reply via email to