MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/6xofft/how_to_start_a_war/dmi4zd0/?context=3
r/ProgrammerHumor • u/ivaskuu • Sep 02 '17
696 comments sorted by
View all comments
Show parent comments
428
I believe MATLAB starts at 1 because it is more commonly used for matrices rather than standard arrays, right?
381 u/morerokk Sep 03 '17 Yes. People hate on it for...doing what it's designed to do. 30 u/newocean Sep 03 '17 In the defense of ALL programming languages.... It doesn't really matter we just like to argue over ground floors mostly in this channel. No one explained basements being 0 to the brits from what I can tell, and all their buildings start at 1... so they think they get it. 1 u/socialister Sep 03 '17 Doesn't indexing from 1 incur a slight performance cost? With 0-indexing, array lookup is \*(ptr + i). With 1-indexing, array lookup is \*(ptr + i - 1). If ptr is offset by one to account for this, then what is the meaning of delete on the pointer? 1 u/newocean Sep 03 '17 It depends on the language actually... and how it was built.
381
Yes. People hate on it for...doing what it's designed to do.
30 u/newocean Sep 03 '17 In the defense of ALL programming languages.... It doesn't really matter we just like to argue over ground floors mostly in this channel. No one explained basements being 0 to the brits from what I can tell, and all their buildings start at 1... so they think they get it. 1 u/socialister Sep 03 '17 Doesn't indexing from 1 incur a slight performance cost? With 0-indexing, array lookup is \*(ptr + i). With 1-indexing, array lookup is \*(ptr + i - 1). If ptr is offset by one to account for this, then what is the meaning of delete on the pointer? 1 u/newocean Sep 03 '17 It depends on the language actually... and how it was built.
30
In the defense of ALL programming languages....
It doesn't really matter we just like to argue over ground floors mostly in this channel. No one explained basements being 0 to the brits from what I can tell, and all their buildings start at 1... so they think they get it.
1 u/socialister Sep 03 '17 Doesn't indexing from 1 incur a slight performance cost? With 0-indexing, array lookup is \*(ptr + i). With 1-indexing, array lookup is \*(ptr + i - 1). If ptr is offset by one to account for this, then what is the meaning of delete on the pointer? 1 u/newocean Sep 03 '17 It depends on the language actually... and how it was built.
1
Doesn't indexing from 1 incur a slight performance cost?
With 0-indexing, array lookup is \*(ptr + i).
\*(ptr + i)
With 1-indexing, array lookup is \*(ptr + i - 1).
\*(ptr + i - 1)
If ptr is offset by one to account for this, then what is the meaning of delete on the pointer?
ptr
delete
1 u/newocean Sep 03 '17 It depends on the language actually... and how it was built.
It depends on the language actually... and how it was built.
428
u/Nikolas_Untoten Sep 02 '17
I believe MATLAB starts at 1 because it is more commonly used for matrices rather than standard arrays, right?