Author |
Topic |
|
o2a
Junior Member
24 Posts |
Posted - Mar 02 2006 : 1:13:43 PM
|
(VAX v10.2.1440.0,VS2005 english)
The keyword "extern" gets removed from the function signature in the parameter-info-tooltip (ctrl-shift-space) EVEN if the word extern is part of an identifier, but only if extern is followed by a white space (includes line break).
e.g.
void test(int counter_extern ); // space before closing brace
void test(int counterextern ); // space before closing brace
void test(int counter_extern , int blah); // space before comma
void test(int counter_extern
,int blah ); // linebreak after extern
The tooltip for all of them shows just "void test(int counter)" - "counter" without "extern". (The 2nd paramter blah shows up correctly where appropriate.)
void test(int counterExtern ); // upper case "Extern"
void test(int counterextern); // no space before closing brace
void test(int counter_extern, int blah); // no space before comma
These show the name correctly.
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Mar 02 2006 : 6:43:22 PM
|
confirmed. thank you for the detailed description, this made it very easy to see what was happening here.
case=1017 |
zen is the art of being at one with the two'ness |
|
|
o2a
Junior Member
24 Posts |
Posted - Mar 02 2006 : 7:29:07 PM
|
Btw, when that code code gets fixed - may be it would be the perfect time to add a missing feature: Showing the template parameters in the info tooltip too. (Currently they are completely stripped from the signature.)
|
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Mar 04 2006 : 09:58:06 AM
|
i don't follow what you mean. using the test function:
testFunc(std::set<std::string> setString);
the parameter is fully displayed in the CTRL-SHIFT tooltip when i call this function.
|
zen is the art of being at one with the two'ness |
|
|
o2a
Junior Member
24 Posts |
Posted - Mar 04 2006 : 12:17:07 PM
|
Sorry, I didn't make it clear indeed. I meant something like
template<int INDEX> void test(int x);
The info tooltip just shows "void test(int x)". It would be nice if it could show the full template signature like "void test<int INDEX>(int x)".
This is a (minor) problem with code completion too. At completion, VAX inserts just the braces but no angle brackets. Hmm, I thought that it would be helpful sometimes to have the angle brackets inserted automatically too (as some sort of a reminder that there are template parameters)... but then again - in cases where the template parameters are optional, because they could be deduced by the compiler, this could get annoying. If VAX could decided that template parameters can not be deduced... but... may be template parameters in the parameter info would be sufficient already.
|
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Mar 06 2006 : 4:34:54 PM
|
*um* is your code example correct? i understand a function returning a template instance, like a std::list, and i understand a void function that does not return anything at all.
i am aware of template functions, but would have to look up the syntax, it has been quite a while since i wrote one, but your code does not seem to be any of these. as a result i am still not clear on what you are talking about here. |
zen is the art of being at one with the two'ness |
|
|
o2a
Junior Member
24 Posts |
Posted - Mar 07 2006 : 6:43:11 PM
|
Ok, my example was a bit misleading if you are not used to templates.
When declaring a template function or class, you have to put the keyword "template" and the template parameter list in front of the entire declaration.
template<int INDEX> void test(int x);
Here the "template"-keyword doesn't relate to the return type alone, but to the declaration itself. It's obviously no good example, since I don't use the parameter INDEX there at all.
A more typical one would be:
template <typename T> void test(T const *param);
Or something like
template <typename T, int SIZE> void test(T const param[SIZE]);
The original example makes sense e.g. in the context of the tuple-type as proposed for the (hopefully) coming C++0x in it's TR1. (A variant of this is implemented by boost::tuple.) There you have a free function named std::get to extract members from a tuple. It's parameter is the tuple itself and the index of the member to extract. To enable the compilers to optimize them, the index is given as a true constant - therefore as an 'int' or 'size_t' template parameter.
A more complete version of the original example would be:
template<int INDEX> void test(std::string id)
{
SomeTupleType &someTuple = getSomeTuple(id);
cout << "Value of " << INDEX << ". element in tuple is "
<< get<INDEX>(someTuple);
}
This example shall not explain the advantage of using tuples or using non-type template parameters anyway. It's just for the sake of template syntax.
|
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Mar 08 2006 : 6:57:31 PM
|
all right, that makes more sense. i looked for the template type being passed in, which would make sense for a template function, but that was not happening.
there is no need to try and explain tuples, i read about them somewhere along the line and understood the point, i have made enough strange, weird and just plain odd lists in my time to have a desire for a std::list of tuples
do you have a simple and fairly clear example of what you are doing, where VA is not showing the full return type? the fact remains that if i understand what you are doing here correctly (which is doubtful, since i am half asleep at the moment) the fact returns that you have a void function, so there is no more return type or template parameter information for VA to display. |
zen is the art of being at one with the two'ness |
|
|
o2a
Junior Member
24 Posts |
Posted - Mar 12 2006 : 04:00:44 AM
|
quote: Originally posted by feline do you have a simple and fairly clear example of what you are doing, where VA is not showing the full return type? the fact remains that if i understand what you are doing here correctly (which is doubtful, since i am half asleep at the moment) the fact returns that you have a void function, so there is no more return type or template parameter information for VA to display.
Ah, no, I have no problem with the return type at all.
It's just that the template parameters are missing from the signature as displayed by VA. Ok, actually they are not a part of the "signature" anyway in it's actual sense, are they?
But it would be nice to have the tooltip display e.g. void test<int INDEX>(int x); for the original example
template<int INDEX> void test(int x);
Or void test<typename T, int SIZE>(T const param[SIZE]); for
template <typename T, int SIZE> void test(T const param[SIZE]);
And to be perfect, VA could determine if one or more template parameters could be deduced from the (normal) argument list and hide them from the actual parameter info tooltip by default, but offering the full parameters as a overload in it's tooltip.
E.g. for
template <typename T> void swap(T value1, T value2); it could display (1) void swap(T value1, T value2); as first overload in the ctrl-shift-space parameter info... ...and the full (2) void swap<typename T>(T value1, T value2); as a second overload.
(I know - they are no "overloads". I mean the variants you get for overloads by using the up- and down-arrow keys when a parameter info is shown )
And last but not least VA could add angular brackets at code completion of templated functions, just as it adds parenthesis already. And once again to be perfect here, there could be an option, if angular brackets should be added for ALL templated functions or only for such whose template parameters cannot be deduced by the compiler itself. (For templated classes there should be angular brackets always, as their parameters cannot be deduced.)
Ok, I know this is very much to ask for. But this should just be a suggestion. Something the VA developers could consider - if it's worth and easy enough to implement.
(What I - and surely many many other people - are much more anticipating, is refactoring support for C++, even if it would be minimal (e.g. "Rename" would be great already) and not 100% bullet proof. The only C++ refactoring tools I'm currently aware of are "Ref++" and "SlickEdit", both extremely slow and instable. And as VA always keeps most of the required information parsed, I'm hoping for a much better refactoring experience with VA.)
Ok, this was quite OT and a definitive sign to stop here. Thanks for your patience! |
Edited by - o2a on Mar 12 2006 04:01:23 AM |
|
|
support
Whole Tomato Software
5566 Posts |
Posted - Apr 14 2006 : 11:28:16 PM
|
Case 1017 is fixed in build 1445. |
|
|
|
Topic |
|