r/code • • Jul 29 '16

Help Please Please help! Need code to announce our pregnancy to my programmer boyfriend... <3

Hi all, my boyfriend is a Senior Software Engineer... I just found out that we are expecting, and I'd love to break the news to him with a block of code! Trouble is, I don't code... Would you all help me write a small block of code to let him know he's going to be a daddy? TIA!

1.3k Upvotes

209 comments sorted by

View all comments

3.3k

u/gonzopancho Jul 30 '16
 Process baby = fork();
 Timer t = setTimer(9 * 30 * 24 * 60 * 60);
 wait4(t);
 baby.cry("Hello, world\n");

 // Yes, honey, we're pregnant.

Interpretation (since you asked /u/super_hewcy)

'fork()' is a system call on linux/unix that spawns a new process. yes, I'm being a wee bit 'dirty' here.

setTImer(9 * 30 * 24 * 60 * 60); <--- basically set a timer for 9 months.

wait4(t); <--- while 'wait4()' is a system call, I'm not using it correctly here, still the implication is "wait for 9 months' (wait for the time to expire)

p.cry("Hello, world\n");

"Hello, world" is the simplest program in many languages. Typically the first program you are shown how to write in a given programming language.

So this is the baby crying (just after birth), "Hello, world"

He'll get it.

(my son is 18 now. enjoy every moment, because one day, you'll realize you have an adult on your hands.)

976

u/bbtta85 Jul 30 '16

Perfect! I love it! Thank you for taking the time to do this!

413

u/almost_not_terrible Sep 04 '16

The // message at the end is a "comment" which is how we developers remind ourselves what a piece of code does.

You can change this bit to your own message, but start the line with //

660

u/Risen_from_ash Sep 04 '16

rewrites comment line

84 compiler errors

312

u/venn177 Sep 04 '16

edits it back

Compile errors still there.

123

u/NotASucker Sep 04 '16

Reverts from source control

Error: Too Many Errors, compilation stopped.

41

u/[deleted] Sep 04 '16

git reset --hard

30

u/phatskat Sep 04 '16

git reset --hard origin/master

Ok, let's try this merge again...fuck!

0

u/[deleted] Sep 04 '16

[deleted] — view deleted comment

18

u/sacesu Sep 04 '16

I have a couple aliases - "git shit" to reset back one commit, and "git fuck #" to reset back to a specific reflog reference.

It's probably not a great practice, but I'm still a noob at merges and I've used "shit" an embarrassing amount of times already.

→ More replies
→ More replies (1)
→ More replies (4)
→ More replies (1)

29

u/[deleted] Sep 04 '16 edited Sep 16 '16

Once I was using valgrind to test my c++ code and it came back and told me I had over 1 million compiler errors.

0

u/[deleted] Sep 04 '16

[deleted] — view deleted comment

16

u/phatskat Sep 04 '16

Achievement unlocked!

Job Security - Generate at least 1 million compiler errors.

→ More replies (2)

22

u/arib510 Sep 04 '16

looks at computer the wrong way

9999 compiler errors

19

u/Natanael_L Sep 04 '16

Gives up, slams keyboard, accidentally hits enter

0 errors, compilation successful

11

u/windyfish Sep 04 '16

I've got 99 compiler errors but a glitch ain't one.

11

u/Ranma_chan Sep 04 '16

I've got 99 compiler errors and my syntax is like 98 of them

→ More replies (1)

97

u/vetlemakt Sep 04 '16

Yeah, you should go with that one. Credit to the others too, but this one's cuter.
Also, congratulations!

11

u/topo10 Sep 04 '16

I stumbled across this from r/bestof and I think this is the best idea ever. I hope he loved it!

→ More replies (53)

136

u/fshowcars Sep 04 '16

Awesome,. You forgot...

Hobbies > /dev/null

33

u/NotASucker Sep 04 '16

In C++ code, wouldn't it be

delete hobbies;

13

u/kaqomaru Sep 04 '16

What are you savage? delete[] hobbies

→ More replies (1)
→ More replies (2)

13

u/jedrekk Sep 04 '16

Pregnancy is 40 weeks more than it is 9 months. We just say 9 months cause that's close enough.

→ More replies (4)
→ More replies (10)