Issue #82 resolved
Igor Balezin
created an issue

Hi! When I use code, created by command:

lua LoadGen.lua -style=pointer_c -spec=gl -version=3.0 -profile=core core_3_0

the compiler creating the warning:

c++ -I/usr/include/SDL2 -D_REENTRANT -c -Wall -DNIX_OS_TYPE -std=c++11 -o ext/gl_core_3_0.o ext/gl_core_3_0.c
...
gl_core_3_0.c:2018:1: warning: ISO C++ forbids converting a string constant to «char*» [-Wwrite-strings]

for the declaration:

static ogl_StrToExtMap ExtensionMap[1] = {
    {"", NULL, NULL},
};

Comments (6)

  1. Jason McKesson repo owner

    C++ is not a strict superset of C. And the code generated by the pointer_c style is ANSI C (89) code, not C++. You aren't mean to compile the generated C code as C++.

  2. Igor Balezin reporter

    Thank you for the answer. Perhaps I ask this question because I recently started working with C ++. I believe, that C ++ is fully compatible with C code. Is not it? After all, the other functions do not cause exceptions.

  3. Jason McKesson repo owner

    I believe, that C ++ is fully compatible with C code. Is not it?

    If you mean that any C code can be compiled as C++, absolutely not. C++ is not backwards compatible with C. It is mostly backwards compatible; a lot of C (89) will compile as C++ just fine. But C++ is not fully backwards compatible.

    You are however perfectly able to link C code with C++ code. You can compile C source files as C and C++ source files as C++, and link all the object files together.

    But you still have to compile the C source files as C, not as C++.

  4. Log in to comment