Skip to content

Generate static members initializers into the declaration#49

Open
martonmiklos wants to merge 1 commit intocornelius:masterfrom
martonmiklos:move_member_initialization_to_declaration
Open

Generate static members initializers into the declaration#49
martonmiklos wants to merge 1 commit intocornelius:masterfrom
martonmiklos:move_member_initialization_to_declaration

Conversation

@martonmiklos
Copy link
Collaborator

Hello David,

I quite like doing the member initialization in the declaration rather than in the constructor.
I created a change which allows me to do this in the libkode generated codes.

Before review I would like to hear your opinion on this one: can we go ahead and enforce this behavior generally or shall I create an optional configuration for it?
If the later I will work on it, if you have no objection please review my change. Thanks!

instead of initialisin in the constructors
@martonmiklos
Copy link
Collaborator Author

Ah my remembering capabilities are quite bad: we started to discuss this in the #37 , so please review this change :)

@dfaure-kdab
Copy link
Collaborator

I certainly like the idea of generating C++-11 code, including initialization in header files. But I have a few concerns/questions:

  1. Doesn't this commit remove initialization of non-static members altogether? I wish libkode had more extensive autotests such as actually generating code and comparing it with reference files... (like KDE's kconfig_compiler autotests)
  2. Doesn't it also remove the type? decl += formatType(v.type()); is gone.
  3. Any reason why you only do this for static members and not for all types of members? On the other hand, (for both static and non-static) I'm worried about the case where the initializer is a function call that requires including another header. But that's rare I suppose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants