News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Editor's C Dialect

Started by mirrorok, August 31, 2020, 12:44:04 PM

Previous topic - Next topic

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

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

mirrorok

QuoteIs syntax highlighting different with C89/C90 ?

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


#include <stdio.h>
#include <stdlib.h>

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


does not compile ...

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
     ^


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?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

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!