T O P I C R E V I E W |
robiwan |
Posted - Oct 26 2007 : 05:18:06 AM (C++)
Would be nice to be able to generate initializers for class members, and/or rearrange them so that they are in the order specified in the header file. Otherwise gcc is spewing out warnings of initializers not being in the correct order (they are always initialized by the compiler in the order they appear in the header) |
10 L A T E S T R E P L I E S (Newest First) |
feline |
Posted - Dec 07 2007 : 3:42:57 PM I don't think I follow. If you want comments in the function in order you might be as well off simply copy / pasting the class member variables and using VA to wrap them in /* */ comments. This is something I have done before, so I have them in front of me in the cpp file, in order, with their type information on hand. |
shawnee6d |
Posted - Dec 07 2007 : 3:25:52 PM Actually, couldn't the current refactor feature do some of this?
I suppose for complex types structs, classes, v1 of the feature might simply add something like:
foo::foo(): int i(0), void* pPtr(NULL) { //foobar();//TODO: add initializer for complex type //foobar2();//TODO: add initializer for complex type }
or something similar in the order specificied in the header. Maybe mark initializer lines that were added to the ctor itself due to complex type? Or am I in outer space?
I'd think that would fit in nicely on the refactor menu, be applicable to a single ctor. Possibly a Refactor::AddCopyCTOR or smart detect that element is a copy ctor is code element the current selection, then generate initializers for that particular ctor using it's reference or ptr param. Kind of a cool notion, but not a trivial or over night feature to do would be my guess. |
sl@sh |
Posted - Dec 04 2007 : 10:04:01 AM Nevermind, I didn't get the intended functionality... |
feline |
Posted - Dec 03 2007 : 10:17:45 AM I don't understand. What sort of thing are you thinking of? |
sl@sh |
Posted - Dec 03 2007 : 06:00:24 AM How about using the Find References window for the marking? Might be a bit of an overkill for most cases, but the users are already familiar with it and it should be easy to implement, no? |
feline |
Posted - Nov 29 2007 : 5:07:49 PM It is an interesting idea, but I wonder what happens as soon as you need to jump to a different file to lookup or check the details of this complex type, so you can correctly initialize it.
Is this how Eclipse works? How does it handle you having to jump around the file, or to a different file, in the middle of doing this? |
SMaton |
Posted - Nov 27 2007 : 1:17:00 PM Hi,
well... I really get this idea from the eclipse IDE which I'm using very often for now: Perhaps it would be possible to initialize the standard types (such as int, float, etc) with 0/NULL. For those which are more complex, put the cursor to the first complex variable, let the user write his initialisation and mark the others. Jump from marker to marker with 'tab' until the user hits enter...
Have fun, Stefan |
feline |
Posted - Nov 14 2007 : 08:16:58 AM In general how is VA to work out the relevant argument for a reference?
If you only have one parameter of the same type as the reference then this is fine, but what about a default constructor? A copy constructor?
I do understand the appeal, but I can also see a lot of problems here that need to be considered. |
tabir |
Posted - Nov 14 2007 : 02:20:39 AM It could be a wonderfull tool. Pointers could be initialized to zero. Referenced could be initialized to the relevant argument.
If you give the basic tool to the user and a flexible customization it will work just fine.
Tal. |
feline |
Posted - Oct 26 2007 : 09:19:36 AM We are considering a command to sort the initializers into the correct order:
case=8368
Generating the list of initializers is harder, since VA will not know how to initialize complex types. If all your class members are "int" and "float" then it is easy, but for classes and structures VA will nto really have any way of producing a default initial value. |