GrandOrgue / grandorgue

GrandOrgue software
Other
166 stars 40 forks source link

Simplified code of GOPipeConfig and GOPipeConfigNode #1782

Closed oleg68 closed 8 months ago

oleg68 commented 8 months ago

This PR:

It is just refactoring. No GO behavior should be changed.

oleg68 commented 8 months ago

Personally I'm not that fond of macro usage for function like content (GOPipeConfig.h line 54 and forward) but it seems to work. Is there any definite advantage over writing out the full function content?

There are two functions with the same code but with different passing of parameters. Using a macro allows to write the code only once.

larspalo commented 8 months ago

Using a macro allows to writhe the code only once.

Yes, I understand how preprocessor directives works by substituting the text. What I asked was if there was any real advantage (beyond not having to write out the body of the function with copy/paste) of using it? In this case, luckily, the macro is found just above the usage of it, which makes it somewhat easier to see/read/understand...

oleg68 commented 8 months ago

beyond not having to write out the body of the function with copy/paste

I always try to avoid the copying/pasting a code because otherwise it would make difficult to support it. For example, If I decided to add something in the code, I would be obligate not to forget to do the same in several places.

The main purpuse of this PR is to remove a lot of repeated code from GOPipeConfig. So I evited to make copy/paste in the new functions.

oleg68 commented 8 months ago

@rousseldenis could you approve this PR?