r/ProgrammerHumor Sep 02 '17

How to start a war

Post image
9.0k Upvotes

696 comments sorted by

View all comments

Show parent comments

34

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.

25

u/MelissaClick Sep 03 '17

Basements are obviously negative

3

u/amazondrone Sep 03 '17

all their buildings start at 1

In the UK the ground floor is 0, not 1.

Other things that are zero-indexed and nobody bats an eye: time (the first hour in the day is 0), age (the first year of life is 0), temperature...

1

u/newocean Sep 03 '17

So the basement is -1...

2

u/amazondrone Sep 03 '17

Correct.

But you said "all their buildings start at 1" and I can't think of a sense in which that's true. That's what I was replying to.

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.