Click here to Skip to main content
15,352,488 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: Cosmetic vs More Efficient Pin
Kirk 103898215-May-21 3:15
MemberKirk 103898215-May-21 3:15 
GeneralRe: Cosmetic vs More Efficient Pin
agolddog5-May-21 3:19
Memberagolddog5-May-21 3:19 
GeneralRe: Cosmetic vs More Efficient Pin
PaltryProgrammer4-May-21 10:07
MemberPaltryProgrammer4-May-21 10:07 
GeneralRe: Cosmetic vs More Efficient Pin
11917640 Member 4-May-21 19:10
Member11917640 Member 4-May-21 19:10 
GeneralRe: Cosmetic vs More Efficient Pin
PaltryProgrammer4-May-21 20:54
MemberPaltryProgrammer4-May-21 20:54 
GeneralRe: Cosmetic vs More Efficient Pin
11917640 Member 4-May-21 22:08
Member11917640 Member 4-May-21 22:08 
GeneralRe: Cosmetic vs More Efficient Pin
PaltryProgrammer4-May-21 22:46
MemberPaltryProgrammer4-May-21 22:46 
GeneralRe: Cosmetic vs More Efficient Pin
W Balboos, GHB5-May-21 1:20
mveW Balboos, GHB5-May-21 1:20 
This question is (despite the little C++ above the code snippet) meant to be considered beyond C++.

One reason for you to consider is those languages that accept a variable argument list and accept an empty argument position (php comes to mind).

So
function sample($x=7) can be invoked:
sample($inVal) or sample() with the latter assigning 7 to the internal value. NULL, however, is more common (for me at least). There's some personal conventions that are standardized that way. For example, in the cases where more than on arg has a default I can fill it's place with NULL (it cannot be empty) and assign a further argument. Often used for strings, actually, where I wish to control minor things such as delimiters, test char sets, and such.

Think of it as a sometimes variable but usually always the same value is desired.

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
Greg Utas4-May-21 10:01
mveGreg Utas4-May-21 10:01 
GeneralRe: Cosmetic vs More Efficient Pin
W Balboos, GHB5-May-21 1:09
mveW Balboos, GHB5-May-21 1:09 
GeneralRe: Cosmetic vs More Efficient Pin
Greg Utas5-May-21 1:17
mveGreg Utas5-May-21 1:17 
GeneralRe: Cosmetic vs More Efficient Pin
PIEBALDconsult4-May-21 11:04
professionalPIEBALDconsult4-May-21 11:04 
GeneralRe: Cosmetic vs More Efficient Pin
obermd4-May-21 18:48
Memberobermd4-May-21 18:48 
GeneralRe: Cosmetic vs More Efficient Pin
Peter Adam4-May-21 22:07
professionalPeter Adam4-May-21 22:07 
GeneralRe: Cosmetic vs More Efficient Pin
PaltryProgrammer4-May-21 23:09
MemberPaltryProgrammer4-May-21 23:09 
GeneralRe: Cosmetic vs More Efficient Pin
jsc424-May-21 23:31
professionaljsc424-May-21 23:31 
GeneralRe: Cosmetic vs More Efficient Pin
Gary Wheeler5-May-21 1:58
MemberGary Wheeler5-May-21 1:58 
GeneralRe: Cosmetic vs More Efficient Pin
W Balboos, GHB5-May-21 2:37
mveW Balboos, GHB5-May-21 2:37 
GeneralRe: Cosmetic vs More Efficient Pin
KateAshman5-May-21 2:27
MemberKateAshman5-May-21 2:27 
GeneralRe: Cosmetic vs More Efficient Pin
W Balboos, GHB5-May-21 2:34
mveW Balboos, GHB5-May-21 2:34 
GeneralRe: Cosmetic vs More Efficient Pin
KateAshman7-May-21 4:25
MemberKateAshman7-May-21 4:25 
GeneralRe: Cosmetic vs More Efficient Pin
Steve Naidamast5-May-21 4:19
professionalSteve Naidamast5-May-21 4:19 
GeneralRe: Cosmetic vs More Efficient Pin
W Balboos, GHB5-May-21 5:21
mveW Balboos, GHB5-May-21 5:21 
GeneralRe: Cosmetic vs More Efficient Pin
Al Gonzalez5-May-21 5:32
MemberAl Gonzalez5-May-21 5:32 
GeneralRe: Cosmetic vs More Efficient Pin
SeattleC++5-May-21 5:57
MemberSeattleC++5-May-21 5:57 

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.


Straw Poll

What language are you using for AI development or learning?
Whether you're at work or home, hard core coding or just trying to figure out this AI thing, which languages have you used in your adventures?
  Results   405 votes