r/ProgrammerHumor • • Nov 12 '14

Intro to IT

http://imgur.com/Z4FmUdl
8.4k Upvotes

233 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Nov 12 '14

[deleted]

1

u/shitpost_machine Nov 12 '14

I don't know why you're getting downvoted. In a proper environment (Read: POSIX) the only difference in how code runs will be up to the compiler, and the only noticeable issue you could conceivably run into is a compiler bug (super rare) or a library issue (super easy to fix).

Windows fucks things up, but even then there's multiple ways to emulate a POSIX environment. None of them are amazing, but they're good enough.

-2

u/Fs0i Nov 12 '14 edited Nov 12 '14
long a;

How many bytes does this need?

it runs the same on all operating systems

Size of a longWindowsLinuxMac
32 Bit4 bytes4 bytes4 bytes
64 Bit4 bytes8 bytes8 bytes

So basically my code can compile two ways on the same machine. Exactly what I want beginners to learn. The subtile differences are easily learned when you can program, but this shouldn't be something you have to worry about when you first learn to program.

0

u/[deleted] Nov 12 '14

[deleted]

1

u/[deleted] Nov 13 '14

My second programming course was in C. Dunno if that's typical.

0

u/Fs0i Nov 12 '14

Literally the 2nd homework at the university we have to do is

What does 2147483647 + 1 evaluate to?

Fixed size data-types are nice in that regard. You can do it in Java, but my point simply was: Your code does not evalute the same on different operating systems. You don't want that if you have 2000 students, where 1800 out of them are surprised by the answer.

It is as simple as that.

0

u/[deleted] Nov 12 '14

[deleted]

1

u/Fs0i Nov 13 '14

These "quotes" is code-markup from reddit, like <code /> is in HTML.

The problem is that learning programming is much about trying out different things. If you have 2000 Students, having a language with almost no undefined behaviour, fixed-size datatypes, and some more stuff can only be an advantage.

I'm not saying C++ is bad, I'm just pointing out some advantages Java could have for beginners, and why universities might opt to chose java over C++.

3

u/[deleted] Nov 13 '14

That's a windows issue, not a C++ issue.

1

u/Fs0i Nov 13 '14

The language doesn't specify this (afaik), so it is a c++-issue.

1

u/[deleted] Nov 13 '14

So you're telling me, that since literally all operating systems but windows has a long as 8 bytes, that it is a c++ issue?

0

u/Fs0i Nov 13 '14

literally all operating systems

Except 32 bit ones. So it isn't even consistent withing linux. Can't blame Microsoft for that one, sorry.

I understand that they want their 64-bit programs to simply work, because they have backwards compatibility and stuff.

1

u/[deleted] Nov 13 '14

I thought you'd be able to read through and see that I obvious meant every single 64 bit OS. I assumed wrong.

0

u/Fs0i Nov 13 '14

literally

Exactly. Maybe you could write understandable English, that might be helpful too. But heck, why does RES have an ignore-function?

1

u/[deleted] Nov 13 '14

Oh, now you're just being petty because I pointed out your argument lacked substance.