Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Matching template brackets
Alpha:
--- Quote from: ollydbg on October 25, 2011, 02:46:57 am ---... We can't even give a precise information whether an identifier is a template or not...
--- End quote ---
Does this mean that there are (a few) cases in which CC can guarantee that it has correctly determined if something is a template? If so, matching could be limited to those cases.
The following algorithm matches some basic cases. (I do not believe it will give any false positives, but I could be wrong.)
* Define registered type as either a static list of knowns (int, char, ...) or a dynamic list acquired from CC (if CC is detected as available). (I assume that CC knows the available types because it provides code hints on them :).)
* Find a '<' with no whitespace, operators, or escape codes (in other words, a single token or nothing) between it and the next '>'.
* If there is no text between the two, match them.
* If the text between the two is a registered type, match them.
thomas:
--- Quote from: Alpha on October 26, 2011, 11:17:51 pm ---Does this mean that there are (a few) cases in which CC can guarantee that it has correctly determined if something is a template? If so, matching could be limited to those cases.
--- End quote ---
That's certainly not a good idea. Either such a feature should work (to the implementor's ability) 100% or not at all. If it works 50% of the time, it is not only worthless, but actually hindering workflow. People will wonder 50% of the time whether they did something wrong when they didn't, just because a color coding they expect does not show.
Alpha:
What about having this as an editor setting that is disabled by default (and with a tool-tip explaining why)? This way, people who go to the effort of activating it would be the ones who want it enough not to be bothered by sporadic behavior. Also, it would give a spot for additional algorithms to be added as they become available.
oBFusCATed:
Because it is a waste of time to implement something which will not work 100% and will be useful to very few people.
smallB:
@obfuscated although I agree with you that it is rather not satisfactory situation when feature doesn't work 100% I have to take and issue.
Nothing works 100%. To greater or lesser extend.
Look at c::b's smartsense. Does it work for 100% of the time? No. Is it useful? Sure. Would it be good to have it improved? Yes, but you see this is only possible if the feature is at least partially implemented. You cannot improve unimplemented feature.
Again, I also cannot agree with you when you say that only few people would use it. From where this assurance comes from? If anything mass of people would at least try it and give feedback (which in turn would allow to improve this feature and so on and so on). Why do I say mass of people not few like you're saying? My reasoning is simple: I personally don't know a C++ dev who doesn't use templates.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version