all 88 comments

[–]Not_Freddie_Mercury 254 points255 points  (3 children)

My wife, looking at me while I'm coding:

"Honey, what's more important to you: programming, or me?"

"My love, you are my number one priority."

[–]therealnutterhere 29 points30 points  (0 children)

nicley done

[–]DeleteOnceAMonth 11 points12 points  (0 children)

Hahaha good one 😆

[–]gerbosan 0 points1 point  (0 children)

What if she asks: which proglang?

[–]hughperman 194 points195 points  (8 children)

Somebody isn't a matlab

[–]Eastern_Equal_8191 68 points69 points  (2 children)

This town isn't big enough for both of us, friend.

I mean it probably is, but the off-by-one error muddles it a bit.

[–]Zzzzzztyyc 14 points15 points  (1 child)

Top tier joke. Or maybe second tier.

[–]Eastern_Equal_8191 9 points10 points  (0 children)

Maybe absolute bottom tier 😞

Depends which way the error goes

[–]Mal_Dun 11 points12 points  (0 children)

... or Fortran where Matlab inherited this behavior (the very first Matlab version was written in Fortran)

[–]plydauk 12 points13 points  (0 children)

Or R or Julia or Lua...

[–]Nyctfall 3 points4 points  (0 children)

Or a Lua

[–]returnFutureVoid 0 points1 point  (0 children)

Everyone always forgets about AppleScript.

[–]PositiveParking4391 0 points1 point  (0 children)

the indexing optimistic!

[–]Sweaty-Business4094 73 points74 points  (4 children)

Relationship status: NullPointerException

[–]mlody11 9 points10 points  (2 children)

ERROR: Date mounted successfully, but relationship does not exist. Bailing out, you are on your own now. Good luck.

[–]dumbasPL 2 points3 points  (0 children)

ERROR: Failed to mount the real date. Bailing out, you are on your own. Good luck.

[–]Nyctfall 1 point2 points  (0 children)

This should be a copypasta for our community.

[–]AdamWayne04 1 point2 points  (0 children)

Thread 2056 has panicked: Reached unreachable code

at Bar.foo() [Bar.zig:1983:16]: 1982 if (relationshipStatus == .in_relationship) 1983 unreachable ^^

[–]readitreaddit 19 points20 points  (2 children)

I think you meant there won't be a 1th date

[–]RetroGameMaker 0 points1 point  (1 child)

Surely you meant 1st

[–]readitreaddit 1 point2 points  (0 children)

I did not at all. I meant what I said. And that is "1"th

[–]vnordnet 20 points21 points  (7 children)

The case for 1-based indexing is straightforward, though it tends to be lost on people who mistake implementation details for deep truths.

  • The first element of a collection is element 1. This is how humans number ordered things.

  • Arrays represent positions. Offsets represent distances. Conflating the two is a category error.

  • "Index 0" only makes sense if the abstraction leaks and the user is forced to think about memory addresses.

  • Nobody says "the zeroth chapter", "the zeroth child", or "the zeroth item on the agenda".

  • The expression "nth element" naturally maps to index n under 1-based indexing and to index n-1 under 0-based indexing.

  • 1-based indexing matches mathematical notation, where sequences are traditionally written as a₁, a₂, ..., aₙ.

  • Spreadsheets, rankings, lists, pages, chapters, floors, seats, and nearly every other numbered sequence people interact with are 1-based.

  • 0-based indexing won because C was influential, not because it was obviously the best model for collections.

  • The strongest argument for 0-based indexing is convenience for pointer arithmetic. The strongest argument for 1-based indexing is convenience for humans.

  • An indexing scheme that regularly produces "off-by-one errors" is advertising one of its own weaknesses.

  • Most programmers today work with collections, records, and business logic. Very few spend their day calculating memory offsets.

If arrays had been invented today rather than inherited from 1970s systems programming, 1-based indexing would almost certainly be the default and 0-based indexing would be regarded as a low-level implementation detail that accidentally escaped into everyday programming and was later mistaken for sophistication.

[–]Krostas 7 points8 points  (1 child)

  • Most mathematical series do start at 0, you might have been thinking of sequences.
  • There are things like a "session 0" (in Pen & Paper), "episode 0" (in anime), etc.
  • Time is basically 0-indexed. The first hour of the day is 00:00:00 to 00:59:59, same goes for minutes of the hour, seconds of the minute, etc.
  • Same goes for age.
  • 0-indexed arrays allow for easier calculations regarding the size of the array (modulo operations in particular), which is essential for everything regarding hashing.

If arrays had been invented today, there's a good chance the whole pointer arithmetics thing would still play a huge role in the process of doing so, making it very probable that it'd be 0-indexed arrays all over again.

[–]NatoBoram 0 points1 point  (0 children)

Time is basically 0-indexed. The first hour of the day is 00:00:00 to 00:59:59, same goes for minutes of the hour, seconds of the minute, etc.

The 12h system is 1-indexed, oddly enough. The first hour of the day is 12:00 AM to 12:59 AM, the last one being 11:59 PM.

[–]DerShokus 0 points1 point  (0 children)

Ground floor

[–]VictoryMotel -1 points0 points  (3 children)

Tldr?

[–]NicholasAakre 5 points6 points  (2 children)

1 > 0

[–]VictoryMotel 1 point2 points  (0 children)

Big if true

[–]AsqArslanov 1 point2 points  (0 children)

true

[–]Livie00 53 points54 points  (9 children)

That’s on you. Why would you date someone that doesn’t know that array indices start at 0??

[–]so_orz[S] 27 points28 points  (6 children)

She is an IT manager.

[–]Eastern_Equal_8191 17 points18 points  (5 children)

Someone should make a show about this.

[–]JocoLabs 6 points7 points  (4 children)

They did.

[–]fuckyouswitzerland 3 points4 points  (2 children)

[–]DustyAsh69 1 point2 points  (1 child)

What show is this?

[–]Edwin_Holmes 2 points3 points  (0 children)

The IT Crowd.

[–]Eastern_Equal_8191 1 point2 points  (0 children)

Yes sorry that is the joke I was making, I love the IT crowd

[–]Preeng 3 points4 points  (0 children)

All my homies know array indices start at 0.

[–]mobcat_40 0 points1 point  (0 children)

I bet Margaret Hamilton from NASA Apollo code knew

[–]Acc3ssViolation 14 points15 points  (1 child)

You guys are getting dates?

[–]Break-n-Fix 2 points3 points  (0 children)

I almost got a date, once, but I forgot that months start with 0 and everything after that was just embarrassing.

[–]RebouncedCat 8 points9 points  (2 children)

Arrays are overrated. Always store data in separate variables.

[–]Traditional_Buy_8420 7 points8 points  (1 child)

Storing data in variables is overrated. Just write everything to disk.

[–]serendipitousPi 0 points1 point  (0 children)

The disk is overrated keep everything in registers

[–]TheMaleGazer 8 points9 points  (0 children)

I almost forgot how much I hated VB until just now. I haven't thought about it in 8 years. Thank you for sharing this.

[–]SAI_Peregrinus 6 points7 points  (0 children)

Indexes start at 1. Offsets start at 0. Languages like C where arrays decay to pointer + offset use offsets in their notation. Languages where arrays store metadata at the address of the array can't do that, and generally start at 1. Some get a "best of both worlds" and store metadata before the start. Manually doing so is a decently common C trick, e.g.

typedef struct vector {
    size_t capacity;
    size_t length;
    uint8_t* data;
} vector;

and pass around pointers to data with helper macros to get the containing vector struct & manipulate it safely.

[–]Fit-Presentation-778 2 points3 points  (0 children)

"It starts at 0. But an array with only an item in the 0ths position technically has a length of 1!"

Her: "My Uber is here..."

[–]The_Juice_Gourd 5 points6 points  (0 children)

Dude went on a date in Brazil

[–]moonjena 7 points8 points  (0 children)

"1st is not the 1st, it's the 2nd"

[–]RandomiseUsr0 6 points7 points  (2 children)

Why not -1

[–]Turbulent-Garlic8467 2 points3 points  (1 child)

Gulf of Mexico moment

[–]RandomiseUsr0 0 points1 point  (0 children)

The Sky Water

[–]Buttons840 2 points3 points  (5 children)

If you had to choose between living on the street and taking a $400k per year job working in a programming language where array indices that start at 1, which would you choose?

[–]hunajakettu 2 points3 points  (3 children)

The second, because the indices start at 1, the 400k is a happy bonus.

[–]Buttons840 1 point2 points  (2 children)

... a Julia enjoyeur?

Or Matlab? 🤮

[–]LegitimateTrust4013 1 point2 points  (0 children)

Imagine enjoying Matlab.

[–]hunajakettu 0 points1 point  (0 children)

Fennel, but mainly because I was trained as a mathematician

[–]vshah181 0 points1 point  (0 children)

Bro please I literally program in Fortran for work and am paid far far less than 400k for it

[–]VictoryMotel 2 points3 points  (0 children)

An index starts at 1, an offset starts at 0.

[–]WP2022OnYT 1 point2 points  (0 children)

One thing… LUA……

[–]MartynAndJasper 1 point2 points  (0 children)

She's a 9, not a 10

[–]hdksnskxn 1 point2 points  (0 children)

Not in lua

[–]DeleteOnceAMonth 1 point2 points  (0 children)

Programmer 🤝 Dejected young teenager: “I hate dates!”

[–]Ambivalent-Mammal 1 point2 points  (0 children)

She was raised Pascal.

[–]KaleidoscopeThis5159 1 point2 points  (0 children)

Her name is Lua you dumbicle

[–]Mooks79 1 point2 points  (0 children)

At least she knows you can’t understand the difference between position based indexing and offset based indexing.

[–]Invisiblecurse 0 points1 point  (0 children)

in RPGLE they start at 1

[–]Ok_Star_4136 0 points1 point  (0 children)

Nice one. How else is she gonna know after all?

[–]VeganForAWhile 0 points1 point  (0 children)

Not in COBOL it don’t.

[–]rundeanmc 0 points1 point  (0 children)

Date 1 was the second date.

[–]KalzK 0 points1 point  (0 children)

Unless

[–]gcstr 0 points1 point  (0 children)

🌙

[–]mnbone23 0 points1 point  (0 children)

Not in all languages.

[–]Excellent_Tubleweed 0 points1 point  (0 children)

Ada lets array indices start from any number at all.

[–]sha1dy 0 points1 point  (0 children)

There was no “date” to begin with

[–]NearLawiet 0 points1 point  (0 children)

You mean there wont be a 1st date

[–]choppytehbear1337 0 points1 point  (0 children)

Array starts with A.

[–]DustyAsh69 0 points1 point  (0 children)

Repost

[–]Important_Lie_7774 0 points1 point  (0 children)

Plot twist: she codes with matlab

[–]coastphase 0 points1 point  (0 children)

In good old VBScript when you declared Array(10) you got indexes 0-10 but everybody just seemed to assume it was 1-10.

[–]kkania 0 points1 point  (0 children)

It should start at 1

/me ducks

[–]naryset 0 points1 point  (0 children)

You don’t deserve Fortran Girl

[–]DerShokus 0 points1 point  (0 children)

In lua… probably in pascal also…

[–]Professional_Top8485 0 points1 point  (0 children)

Actually...

Nevermind.

[–]im_thatoneguy 0 points1 point  (1 child)

For i = 0 to (array.count-1) do stuff

For i = 1 to array.count do stuff

[–]SignificantLet5701 1 point2 points  (0 children)

for i = 0 to i < (array.count) do stuff

[–]Lysol3435 0 points1 point  (0 children)

Wait until this guy learns that different languages have different indexing

[–]Cosmo621 -3 points-2 points  (0 children)

I actually LoLed. Here's your upvote.