Author Topic: Editor's C Dialect  (Read 295 times)

Offline mirrorok

  • Single posting newcomer
  • *
  • Posts: 3
Editor's C Dialect
« on: August 31, 2020, 12:44:04 pm »
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.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2814
Re: Editor's C Dialect
« Reply #1 on: August 31, 2020, 01:42:11 pm »
Quote
Errors, 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 ?

Offline mirrorok

  • Single posting newcomer
  • *
  • Posts: 3
Re: Editor's C Dialect
« Reply #2 on: August 31, 2020, 02:06:15 pm »
Quote
Is syntax highlighting different with C89/C90 ?

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

Code: [Select]
#include <stdio.h>
#include <stdlib.h>

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

does not compile ...

Code: [Select]
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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12779
    • Travis build status
Re: Editor's C Dialect
« Reply #3 on: August 31, 2020, 07:28:03 pm »
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!]

Offline mirrorok

  • Single posting newcomer
  • *
  • Posts: 3
Re: Editor's C Dialect
« Reply #4 on: September 02, 2020, 10:13:02 am »
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!