Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for C++17 #36

Closed
ninkibah opened this issue Jun 16, 2018 · 4 comments
Closed

Support for C++17 #36

ninkibah opened this issue Jun 16, 2018 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@ninkibah
Copy link

It seems that the code uses CLang 4.9 on the website. Is it possible to update to Clang 6?
Also, it might be nice to choose which language standard to use.
I searched in vane for a place to add compiler flags.

@andreasfertig andreasfertig added the enhancement New feature or request label Jun 17, 2018
@andreasfertig andreasfertig self-assigned this Jun 17, 2018
@andreasfertig
Copy link
Owner

Hi,

thanks for pointing that out. There is a reddit comment which mentions that std::byte is not working.

After some struggle it looks like I figured it out. The web front-end now runs with gcc/g++ 7 headers and with -std=c++17 enabled. Hope that fits your needs.

Regarding the compiler flags, I have no intention to let people pass them because I do not see the relevance. What I can imagine is choosing the standard: C++11, C+14 and so on. But they should also not be passed as string but rather as some sort of index or so. In addition the generated link should take that into account. If you like to add this to the web part, I would be happy about a pull request.

On that note, it anybody likes to have other headers install, abseil, boost or something like that let me know.

@VictorQRS
Copy link

VictorQRS commented Oct 16, 2018

Hello @andreasfertig ,

I know that this issue is closed, but I was intending to open a new one about compiler flags, so this place seems appropriate to start a discussion before creating a new issue.

As you said, allowing the user to add compiler flags seems irrelevant, except the stardard. But, I do believe that there is another flag that changes radically how the compiler "sees" the code: the optimization flags.

Using no optimization, the code is likely close to what I wrote in the source code, but using higher levels of optimization, the inference of the compiler gets so high that it actually changes the resulting code (assembly).

For example, the code below would be real close to what the compiler "sees"if no optimization flag was used:

#include <iostream>

int foo() {
    int m = 1;
    return m;
}

int main() {
    std::cout << foo() << std::endl;
    return 0;
}

But if -03 was used, the likely ouput would be closer to something like this:

#include <iostream>

int main() {
    std::cout << 1 << std::endl;
    return 0;
}

Therefore, it would be nice to be able to see this differences in optimizations modes.

@andreasfertig
Copy link
Owner

Hello Victor,

thanks for bringing this up. I just checked and it makes no difference whether it is -O0 or -O3. I believe that optimization kicks in after the AST was generated. It could be that there are some really cheap optimization which are hard to ignore than to just do, but other than that I think it will not show up in C++ Insights.
You can test it yourself by downloading the pre-compiled version. Let me know if you come to a different conclusion.

@andreasfertig
Copy link
Owner

And of course, I would accept and appreciate a patch to add selecting either the optimization level and or the Standard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants