Author Topic: C code coloring problem  (Read 649 times)

Offline ordak

  • Multiple posting newcomer
  • *
  • Posts: 11
C code coloring problem
« on: March 30, 2017, 07:20:04 am »
Hi,

using code::blocks svn build in Linux, I get the following mis-colored (black instead of blue):

* noreturn defined in <stdnoreturn.h>

* using typedef, the newly defined types


Offline BlueHazzard

  • Lives here!
  • ****
  • Posts: 1370
Re: C code coloring problem
« Reply #1 on: March 31, 2017, 12:37:08 am »
code highlightening is static at the moment... So this is not parsed automatically. If you need it you can set (add keywords) it in the setting somewhere

If you have time and will you are free to send patches and help to improve codeblocks ;)


Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 4908
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: C code coloring problem
« Reply #2 on: March 31, 2017, 07:00:18 am »
* noreturn defined in <stdnoreturn.h>
So, "noreturn" should be shown in blue color? Your post is a bit hard to read.  ;)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ordak

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: C code coloring problem
« Reply #3 on: April 01, 2017, 11:14:13 am »
* noreturn defined in <stdnoreturn.h>
So, "noreturn" should be shown in blue color? Your post is a bit hard to read.  ;)

I expect "noreturn" and  "the newly defined types" to be shown in blue rather than black. Just as types like "int", "bool" and so on.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10056
Re: C code coloring problem
« Reply #4 on: April 01, 2017, 11:23:21 am »
What do you mean by newly defined types? Is this some newer C standard?
<debugger plugin maintainer>
(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 ordak

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: C code coloring problem
« Reply #5 on: April 01, 2017, 04:31:31 pm »
What do you mean by newly defined types? Is this some newer C standard?

As I mentioned previously in the first post, I mean the types that are defined using "typedef" specifier. For example see:

http://en.cppreference.com/w/cpp/language/typedef

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10056
Re: C code coloring problem
« Reply #6 on: April 01, 2017, 06:01:17 pm »
So you want to do:
Code: [Select]
typedef sometype mytype;
And then if you use mytype you want it different colour?
This is called semantic highlighting and it is not supported by C::B.
<debugger plugin maintainer>
(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 ordak

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: C code coloring problem
« Reply #7 on: April 02, 2017, 12:44:14 pm »
So you want to do:
Code: [Select]
typedef sometype mytype;
And then if you use mytype you want it different colour?
This is called semantic highlighting and it is not supported by C::B.

I want "mytype" to be colored as "sometype" , which is blue in my Linux PC. Is not there a plugin for this "semantic highlighting" ?

Offline ordak

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: C code coloring problem
« Reply #8 on: April 03, 2017, 09:05:29 am »
Ok, I added those as keywords, manually and they are colored correctly now:

"Settings->Editor->Syntax highlighting->Keywords"

Select appreciate "Set" and add the keywords.