« first day (1015 days earlier)      last day (1828 days later) » 

3:46 AM
@Dariusz Not a good idea, but if you really it, there should be no problem compiling a long list. You might want to look at "strong type" libraries. Like adding units to values, the extra amount of boilerplate makes it not worth while.
 
 
5 hours later…
Ron
9:15 AM
Noobish question. How to modify the part of the condition based on function parameter value without multiple ifs?
How to modify the complexcondition part based on some function parameter value , inside the function body if (condition1 && complexcondition)?
 
nwp
I don't really understand the question, but switch can be an alternative to if/else chains.
 
Ron
Indeed, early morning brain freeze on my side.
another noobish question
Can I force group the condition with double parentheses
((param == 123 && something = something2) || (param == 456 && something = something3))?
Which will be a part of the larger condition itself?
 
nwp
9:35 AM
Yes, but this condition doesn't look right. The && binds stronger than the = which is probably not what you want.
 
Ron
Typo, was meant ==.
 
nwp
In that case you don't even need extra parenthesis.
Might leave them in for clarity.
 
Ron
What if there were more conditions before this one?
(veryimportantcondition1 && veryimportantcondition2 && (param == 123 && something = something2) || (param == 456 && something = something3) || (param == 789 && something = something4))?
 
nwp
Then you have to check if it does what you want. Some people check the operator precedence to see if it gets parsed the way they want. Others say if you need to look up precedence rules then your expression is too complicated and you should add some helpers.
You can combine those conditions as much as you want. While it eventually becomes a challenge to keep it readable, the compiler doesn't care.
 
Ron
I see. Many thanks.
By helper do you mean an external function?
 
nwp
9:41 AM
No, something like bool need_updating = param == 123 && something == something2; and then use that in the big condition. That way you can name the individual conditions. Although you lose out on short circuting / lazy evaluation.
 
Ron
Awesome.
Thanks a lot.
 
 
3 hours later…
12:36 PM
3
Q: Are both of these volatile qualifier usages redundant?

iksemyonovConsider volatile int volatile * volatile vip; // (1) and volatile int volatile * volatile vipa[10]; // (2) Both lines of code trigger -Wduplicate-decl-specifier (see rev 236142 and gcc7 release notes). I'd like to know if I can remove some volatile specifiers from the given code without ch...

 
@iksemyonov I swapped out qualifiers for so it would get better exposure since it's a standards question
 
1:05 PM
@Mgetz Ok, fair, thanks!
 

« first day (1015 days earlier)      last day (1828 days later) »