TransWikia.com

Syntax highlighting in C++ fails in user-defined literals

Emacs Asked by Vroomfondel on February 19, 2021

The C++11 way to separate the parts of a user-defined numeric (integer or floating point) literal with ' as e.g. in 1'500ms stalls parsing for syntax highlighting. I couldn’t find anything on the net about this – my new team makes heavy use of this and I am the only Emacs user, so it is me who has to adapt. Is there a way to make the parser for C++ recognize the new syntax without too much hassle? See also: https://en.cppreference.com/w/cpp/language/user_literal

One Answer

What version of emacs do you use? I'm not able to reproduce the problem in Emacs 27.1, using this test program:

#include <iostream>
#include <chrono>

int main()
{
    using namespace std::chrono;
    std::chrono::milliseconds t = 1'234ms;
    std::cout << t.count() << 'n';
}

Correct answer by db48x on February 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP