News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

C code coloring problem

Started by ordak, March 30, 2017, 07:20:04 AM

Previous topic - Next topic

ordak

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

Code::Blocks SVN
OS : Ubuntu LTS

BlueHazzard

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 ;)


ollydbg

Quote from: ordak on March 30, 2017, 07:20:04 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.

ordak

Quote from: ollydbg on March 31, 2017, 07:00:18 AM
Quote from: ordak on March 30, 2017, 07:20:04 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.
Code::Blocks SVN
OS : Ubuntu LTS

oBFusCATed

What do you mean by newly defined types? Is this some newer C standard?
(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!]

ordak

Quote from: oBFusCATed on April 01, 2017, 11:23:21 AM
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
Code::Blocks SVN
OS : Ubuntu LTS

oBFusCATed

So you want to do:

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.
(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!]

ordak

Quote from: oBFusCATed on April 01, 2017, 06:01:17 PM
So you want to do:

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" ?
Code::Blocks SVN
OS : Ubuntu LTS

ordak

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.
Code::Blocks SVN
OS : Ubuntu LTS