Click here to Skip to main content
15,860,859 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Proper Science Fiction Films Pin
PIEBALDconsult4-May-21 9:20
mvePIEBALDconsult4-May-21 9:20 
GeneralRe: Proper Science Fiction Films Pin
Maximilien4-May-21 10:11
Maximilien4-May-21 10:11 
NewsRe: Proper Science Fiction Films Pin
Super Lloyd4-May-21 13:47
Super Lloyd4-May-21 13:47 
GeneralRe: Proper Science Fiction Films Pin
Slow Eddie5-May-21 4:15
professionalSlow Eddie5-May-21 4:15 
GeneralRe: Proper Science Fiction Films Pin
BernardIE53175-May-21 5:53
BernardIE53175-May-21 5:53 
GeneralRe: Proper Science Fiction Films Pin
Saša Ćetković5-May-21 7:08
professionalSaša Ćetković5-May-21 7:08 
GeneralRe: Proper Science Fiction Films Pin
Slow Eddie6-May-21 1:37
professionalSlow Eddie6-May-21 1:37 
GeneralCosmetic vs More Efficient Pin
W Balboos, GHB4-May-21 6:29
W Balboos, GHB4-May-21 6:29 
The difference may be slight but one of the conundrums I find myself in is using a ternary operator to handle a default vs non-default assignment.

Simplified:
C++
function whatEver(inVal=NULL) { // here, NULL is a default value for a function argument 

// This ?
 if(inVal==NULL)
   inVal = internalDefault;

// or this?
 inVal = (inVal==NULL)?internalDefault:inVal;


} // function whatEver(inVal=NULL)


The first should be a touch more efficient as it only does an assignment when necessary, but generally an insignificant difference.

So - what would you do, and, do you ever pause and consider it before choosing?

Ravings en masse^
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
"If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010

GeneralRe: Cosmetic vs More Efficient Pin
Maximilien4-May-21 6:40
Maximilien4-May-21 6:40 
GeneralRe: Cosmetic vs More Efficient Pin
MichaelLuna5-May-21 19:43
MichaelLuna5-May-21 19:43 
GeneralRe: Cosmetic vs More Efficient Pin
Jörgen Andersson4-May-21 7:06
professionalJörgen Andersson4-May-21 7:06 
GeneralRe: Cosmetic vs More Efficient Pin
Rusty Bullet5-May-21 3:13
Rusty Bullet5-May-21 3:13 
GeneralRe: Cosmetic vs More Efficient Pin
jsc425-May-21 5:11
professionaljsc425-May-21 5:11 
GeneralRe: Cosmetic vs More Efficient Pin
Rusty Bullet5-May-21 5:25
Rusty Bullet5-May-21 5:25 
GeneralRe: Cosmetic vs More Efficient Pin
Andre_Prellwitz5-May-21 10:55
Andre_Prellwitz5-May-21 10:55 
GeneralRe: Cosmetic vs More Efficient Pin
MarkTJohnson4-May-21 7:21
professionalMarkTJohnson4-May-21 7:21 
GeneralRe: Cosmetic vs More Efficient Pin
Daniel Pfeffer4-May-21 7:34
professionalDaniel Pfeffer4-May-21 7:34 
GeneralRe: Cosmetic vs More Efficient Pin
MarkTJohnson4-May-21 7:40
professionalMarkTJohnson4-May-21 7:40 
GeneralRe: Cosmetic vs More Efficient Pin
Mircea Neacsu4-May-21 9:32
Mircea Neacsu4-May-21 9:32 
GeneralRe: Cosmetic vs More Efficient Pin
W Balboos, GHB5-May-21 0:58
W Balboos, GHB5-May-21 0:58 
GeneralRe: Cosmetic vs More Efficient Pin
Mircea Neacsu5-May-21 2:47
Mircea Neacsu5-May-21 2:47 
GeneralRe: Cosmetic vs More Efficient Pin
W Balboos, GHB5-May-21 2:58
W Balboos, GHB5-May-21 2:58 
GeneralRe: Cosmetic vs More Efficient Pin
Kirk 103898215-May-21 3:15
Kirk 103898215-May-21 3:15 
GeneralRe: Cosmetic vs More Efficient Pin
agolddog5-May-21 3:19
agolddog5-May-21 3:19 
GeneralRe: Cosmetic vs More Efficient Pin
BernardIE53174-May-21 10:07
BernardIE53174-May-21 10:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.