User forums > Using Code::Blocks

Editor's C Dialect

(1/1)

mirrorok:
I have setup my compiler (mingwm) to C dialect ANSI. This is working for me fine. If I e.g. enter a line comment I receive error messages as expected.

But how to setup C89/C90 or whatever dialect to the C-Editor in Code:Blocks? Errors, Syntax-Highlighting ect. should apply to that dialect too in my point of view.

I'm used to Eclipse IDE, when I change to a different Java Version the Editor show up a different behavior.

BlueHazzard:

--- Quote ---Errors, Syntax-Highlighting ect. should apply to that dialect too in my point of view.
--- End quote ---
Codeblocks does not have "live error" checking... Is syntax highlighting different with C89/C90 ?

mirrorok:

--- Quote ---Is syntax highlighting different with C89/C90 ?
--- End quote ---

I think so, e.g. In-Line-Comments ...


--- Code: ---#include <stdio.h>
#include <stdlib.h>

int main()
{
    // Comment
    printf("Hello world!\n");
    return 0;
}

--- End code ---

does not compile ...


--- Code: ---gcc.exe -Wall -std=c90 -g  -c C:\script\C\Sandbox\main.c -o obj\Debug\main.o
gcc.exe  -o bin\Debug\Sandbox.exe obj\Debug\main.o   
C:\script\C\Sandbox\main.c: In function 'main':
C:\script\C\Sandbox\main.c:6:5: error: C++ style comments are not allowed in ISO C90
     // Comment
     ^

--- End code ---

Also the StdLib is different and this should be considered as well.

oBFusCATed:
The scintilla (the editor library we're using) lexer for C is not separate but it is common for both C and C++. And I'm not sure it has options to specify the dialect for C or C++. If you can set this up in scite or another scintilla based editor (notepad++, geany, codelite) we could probably implement this. But I don't think it is high priority. Also the editor part and the build part aren't really connected, so it would be confusing if you have a c89 project, but open an external c99 or c11 file. What should happen in this case?

mirrorok:
It was more a question if I probably just did not find the option to setup the dialect in CodeBlocks rather than a request for a modify or change. But good to know scintilla is used. Maybe I will find a custom ANSI C lexer somewhere in the future.

Thanks!

 

Navigation

[0] Message Index

Go to full version