Developer forums (C::B DEVELOPMENT STRICTLY!) > Compiler Framework Redesign

New compiler line type: cltInfo

<< < (4/5) > >>

MortenMacFly:

--- Quote from: rickg22 on June 20, 2007, 05:55:34 pm ---Ok, I'll update it and pump up the version (again) to 0.0.3.

--- End quote ---
Be careful: killerbot did already some change in r 4115.


--- Quote from: rickg22 on June 20, 2007, 05:55:34 pm ---:P Just a last question. Should cltInfo be the second, or the last? Because in other files i assummed that cltWarning will always be greater than cltInfo.

--- End quote ---
I believe the ">=" stuff won't work and I guess it's really better to use a switch case construct... what do you think?

With regards, Morten.

mandrav:

--- Quote from: rickg22 on June 20, 2007, 05:55:34 pm ---
--- Quote from: mandrav on June 20, 2007, 09:55:08 am ---Initialize cltNormal to 0 too, so we have predefined numbers...

--- End quote ---

You mean it's initialized to ONE???  :shock:

--- End quote ---

No, I mean you don't really know what number the compiler will use for the first enumerator. It should be 0 but you don't know it for sure, and certainly not if you use a different-than-gcc compiler.
So, what I 'm saying is initialize the first enumerator to 0 and everything will be well defined.

thomas:

--- Quote from: mandrav on June 20, 2007, 06:03:41 pm ---No, I mean you don't really know what number the compiler will use for the first enumerator. It should be 0 but you don't know it for sure, and certainly not if you use a different-than-gcc compiler.
--- End quote ---
Hmm actually that's in the C++ standard... but it certainly does not hurt to explicitely set it to 0. First, to account for broken compilers, and second for human readers who might possibly expect something else :)



--- Quote from: MortenMacFly on June 20, 2007, 06:00:55 pm ---I believe the ">=" stuff won't work and I guess it's really better to use a switch case construct... what do you think?
--- End quote ---
I use such constructs every day, they work nicely (as it happens, the new logging system distinguishes info from error like this too). enum values start at 0 and are incremented by 1 unless you tell the compiler something different. Thus, by properly ordering the enums (which is sensible, anyway), you can determine the "general nature" of a "thing" very easily and efficiently.

This btw. is one of the few things that are implemented really, really well in wxWidgets. On all stock items and all items created with defaults, you can tell from an item's (control, font, cursor, colour, language, encoding...) ID what it is.
Well, you should of course not do it for compatibility's sake, but the toolkit can tell what "unknown thing with ID foo" is, and that's pretty darn cool.

killerbot:
in the enum the first entry is 0, C/C++ does that, but we added it explicitly to make it more standing out ;-)

DO NOT change the order of the enum anymore, I fixed it. New enum values have to be added to the end, don't insert !!!!

MortenMacFly:

--- Quote from: thomas on June 20, 2007, 06:28:41 pm ---I use such constructs every day, they work nicely (as it happens, the new logging system distinguishes info from error like this too).

--- End quote ---
Sure you can use it if it makes sense. But after the latest change the order of the items will be:

--- Code: ---enum CompilerLineType
{
  cltNormal = 0,
  cltWarning,
  cltError,
  cltInfo
}

--- End code ---
Tell me how you get the same functionality in those cases with >=???
With regards, Morten.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version