Can C++ variables in cpp file defined as Special Symbols β

前端 未结 3 433
太阳男子
太阳男子 2021-01-21 14:11

Can we define the variable in c++/ c using special characters such as;
double ε,µ,β,ϰ;

If yes, how can this be achieved?

3条回答
  •  野的像风
    2021-01-21 15:00

    Since the question is tagged Visual Studio: Just write the code as you'd expect it.

    double β = 0.1;

    When you save the file, Visual Studio will warn you that it needs to save the file as Unicode. Accept it, and it works. AFAICT, this also works in C mode, even though most other C99 extensions are unsupported in Visual Studio.

    However, as of g++ 8.2, g++ still does not support non-ASCII characters used directly in identifiers, so the code is then effectively not portable.

提交回复
热议问题