Click here to Skip to main content
15,886,919 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: I like C more than I thought I would Pin
honey the codewitch14-Sep-22 22:14
mvahoney the codewitch14-Sep-22 22:14 
GeneralRe: I like C more than I thought I would Pin
giulicard14-Sep-22 21:57
giulicard14-Sep-22 21:57 
GeneralRe: I like C more than I thought I would Pin
honey the codewitch14-Sep-22 22:13
mvahoney the codewitch14-Sep-22 22:13 
GeneralRe: I like C more than I thought I would Pin
giulicard14-Sep-22 22:25
giulicard14-Sep-22 22:25 
GeneralRe: I like C more than I thought I would Pin
honey the codewitch14-Sep-22 23:04
mvahoney the codewitch14-Sep-22 23:04 
GeneralRe: I like C more than I thought I would Pin
Martin ISDN14-Sep-22 23:35
Martin ISDN14-Sep-22 23:35 
GeneralRe: I like C more than I thought I would Pin
honey the codewitch14-Sep-22 23:53
mvahoney the codewitch14-Sep-22 23:53 
GeneralRe: I like C more than I thought I would Pin
Martin ISDN15-Sep-22 2:22
Martin ISDN15-Sep-22 2:22 
honey the codewitch wrote:
I'm surprised this astonished you, as it's the default in most any programming language including asm, where the most natural way to call is to put a copy of a value in a register or onto the stack. Indeed to pass by reference you need to put the address of the object in a register or on the stack. BASIC facilitates this using the Byref keyword, C# with the ref and out keywords, but it's pretty much always extra typing. The exception is arrays including strings, because you reference them (in C by referencing the first element), and while in theory you could push each element onto the stack in practice that's prohibitive.

probably i wanted to give Dennis more credit than he deserves. once an idea like "i have underrated C, Dennis was more clever and foreseeing than i thought. he made the right compromises" appeared in my mind it is constantly working in the background trying to find new prof of greatness.

cannot test it, but the BASICs on the home computers may have been default to pass by reference. that set the intuition that the function changes the callers arguments at very young age

though, he made copy by value the only way to pass. except for that array!
i often wonder at length, why he did so. the default way is to pass it by reference i suppose for economical reasons. there is a way to pass it by copy if you put it inside a struct. or simply, cast the array as a struct.

i wish i could find some paper written by Ritchie about this or "the other things, not because they are easy, but because they are hard"
GeneralRe: I like C more than I thought I would Pin
honey the codewitch14-Sep-22 23:58
mvahoney the codewitch14-Sep-22 23:58 
GeneralRe: I like C more than I thought I would Pin
Cpichols15-Sep-22 2:23
Cpichols15-Sep-22 2:23 
GeneralRe: I like C more than I thought I would Pin
Juan Pablo Reyes Altamirano15-Sep-22 4:43
Juan Pablo Reyes Altamirano15-Sep-22 4:43 
GeneralRe: I like C more than I thought I would Pin
sasadler15-Sep-22 6:14
sasadler15-Sep-22 6:14 
GeneralRe: I like C more than I thought I would Pin
honey the codewitch15-Sep-22 6:19
mvahoney the codewitch15-Sep-22 6:19 
GeneralRe: I like C more than I thought I would Pin
rjmoses17-Sep-22 23:39
professionalrjmoses17-Sep-22 23:39 
GeneralRe: I like C more than I thought I would Pin
honey the codewitch17-Sep-22 23:49
mvahoney the codewitch17-Sep-22 23:49 
GeneralRe: I like C more than I thought I would Pin
rjmoses19-Sep-22 0:29
professionalrjmoses19-Sep-22 0:29 
GeneralRe: I like C more than I thought I would Pin
Clive Hudson23-Sep-22 5:52
Clive Hudson23-Sep-22 5:52 
GeneralRe: I like C more than I thought I would Pin
honey the codewitch23-Sep-22 7:09
mvahoney the codewitch23-Sep-22 7:09 
AnswerPrograming gut feeling - ** Update! ** Pin
megaadam13-Sep-22 23:37
professionalmegaadam13-Sep-22 23:37 
AnswerRe: Programing gut feeling Pin
honey the codewitch13-Sep-22 23:39
mvahoney the codewitch13-Sep-22 23:39 
AnswerRe: Programing gut feeling Pin
CPallini14-Sep-22 0:27
mveCPallini14-Sep-22 0:27 
AnswerRe: Programing gut feeling Pin
OriginalGriff14-Sep-22 0:44
mveOriginalGriff14-Sep-22 0:44 
GeneralRe: Programing gut feeling Pin
honey the codewitch14-Sep-22 1:03
mvahoney the codewitch14-Sep-22 1:03 
AnswerRe: Programing gut feeling Pin
Greg Utas14-Sep-22 1:07
professionalGreg Utas14-Sep-22 1:07 
AnswerRe: Programing gut feeling Pin
Randor 14-Sep-22 1:21
professional Randor 14-Sep-22 1:21 

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.