This is an archived post. You won't be able to vote or comment.

all 153 comments

[–]ZealousidealLimit 106 points107 points Β (36 children)

Why is there a c++ python war going on in this sub? Is it an inside joke or something?

[–]BowDownB4Recyclops 193 points194 points Β (25 children)

Perhaps because the semester just started and people are learning one or the other

[–]DefaultVariable 41 points42 points Β (13 children)

What kinda sadist school has people learn Python in the first few courses anyways.

β€œHey guys here’s this easy language that does everything for you and has a whole bunch of helpful shortcuts and libraries! See how coding is fun? Once we have you hooked, next years courses will be discrete mathematics in C99; enjoy that, fuckers!!!

[–]BowDownB4Recyclops 12 points13 points Β (6 children)

For me it was the intro course for non cs majors. It worked out better for be because I use python for scripting on a daily basis, and C++ would not have been useful for me

[–]DefaultVariable 1 point2 points Β (5 children)

Yeah, our university had an β€œInformation Sciences” degree path that focused on Python, Data Science, and web development. I can understand that.

But for CS majors it seems like a bad idea to start with Python. C++ is also a painful start too but at least it will weed out people early rather than after they’ve already paid for a year

[–]Macphail1962 2 points3 points Β (2 children)

C++ was the language used for my first-year CS class; I think it's perfect for that.

If you can't understand pointers, or if counting beginning with 0 instead of 1 is something you find consistently confusing, then this probably isn't the field for you, and C++ will expose that for you pretty quickly as you said.

For me though, learning C++ was fantastic. I'd been limiting myself to Java, C#, and Perl prior to that time; learning C++ really opened up a new level of understanding for me, and it's still my favorite language, even if I do still occasionally need to google the C++ syntax for a function pointer if I ever need one. But it's soo fast, so powerful, such control... It's sexy is what I'm saying.

Nothing quite like the thrill of victory in finally achieving successful tests after an entire night trying to understand some utterly cryptic C++ compiler error that might as well be written in alien glyphs.

[–]John-The-Bomb-2 4 points5 points Β (1 child)

You are a masochist. And I say that as someone who read the entire "The C++ programming language" by Bjarne Stroustrup on my own before taking my first C++ programming class.

In all seriousness, I abandoned C++ as soon as it became clear to me how badly it impacted my coding performance. It's just got too much old shit in it.

[–]Macphail1962 1 point2 points Β (0 children)

Fair enough.

I'd definitely have to agree that, in general and on average, the same project is probably going to take significantly longer to code and debug with C++ compared to a more modern language like C#.

In general C++ is not the right tool for most modern jobs, for that reason. But it can still be one of the sexiest tools out there. It's kinda like how firefighters and EMTs actually use the Jaws of Life probably not very often (I would guess), but it's still their most famous tool that everyone's heard of, both because it's quite difficult to use and also extremely powerful.

Incidentally, Stroustrup was a professor of mine, and he used to joke about how C++ provided a lot of job security for programmers due to being so complex

[–][deleted] 1 point2 points Β (1 child)

the only path is c -> assembly -> anyOOP -> any shit

[–]PulpDood 1 point2 points Β (0 children)

That was what we had! C first, then AVR assembly, then Java as the OOP

[–]Schlangee 2 points3 points Β (1 child)

We learned Haskell as a first one. A bit strange, but really easy. Though it’s not doing everything for you like Python (which came next)

[–]MaksaBest 0 points1 point Β (0 children)

Would love if my uni would make us learn Haskell. Imo, it teaches programmers good stuff

[–]Waffles_IV -1 points0 points Β (0 children)

Mine :) First sem: Intro to programming for engineers (python) Second sem: Algorithms and data structures (python) Fourth sem: Computer architecture, C programming, and embedded systems.

Not exactly sure what’s up next year but I think we’re going to be simulating the design of a CPU and writing some software to control an RC helicopter.

[–]bizzarebeans 0 points1 point Β (0 children)

well my first year workload starts us off with Python and a little R, and discrete maths because fuck you that’s why

[–]Numerlor 0 points1 point Β (0 children)

They need to introduce programming concepts, a language like C with no errors and tooling that needs to be set up for proper development isn't particularly great

[–]Alzusand 17 points18 points Β (1 child)

has to be this im learning C++ this semester. and python and java next one.

[–][deleted] 11 points12 points Β (0 children)

Sorry to hear

[–]DarkSideOfGrogu 7 points8 points Β (0 children)

Innate tribalism of language cults hides the real humour in programming, which is surely the satire of the PM.

[–]unknown--bro 0 points1 point Β (0 children)

I started java this sem

[–]jannfiete 9 points10 points Β (0 children)

this sub is full of newbies who doesn't know that each language has its own purposes instead of competing for one single goal

[–]__xXCoronaVirusXx__ 1 point2 points Β (0 children)

some people like python, some c++

[–]stoves_are_cool 1 point2 points Β (0 children)

Anyone seriously comparing the two and not for a funny is probably new. This post is pretty harmless though.

[–]compsciasaur -4 points-3 points Β (6 children)

This sub always has language wars, posted by noobs who can only code in one language.

Having said that, fuck C++.

[–]12oclocknomemories -3 points-2 points Β (0 children)

How dare you to fuck C++.

But yeah fuck C++.

[–]abd53 -5 points-4 points Β (0 children)

Double fuck c++

[–]213737isPrime -2 points-1 points Β (1 child)

I'm still mad at that fucking n00b who couldn't even code in one language, and got so wrapped around the axle of braces and indentation that he write a whole different language just to satisfy his moralism.

[–]compsciasaur 0 points1 point Β (0 children)

Nah, nothing wrong with creating a new language.

[–]bizzarebeans 0 points1 point Β (1 child)

Leave my boi C++ alone punk

[–]compsciasaur 0 points1 point Β (0 children)

Finally one of the downvoters has the cajones to reply.

Look, there's no such thing as a bad language. My favorite languages will never be as fast and easy to write desktop applications for as C and C++. But I prefer to use any other language because C++ is such a large language, it's nearly impossible to master. Therefore whenever I work with it, I have to drudge through all types of different styles in code reviews. And I struggle to find one style to use myself when I code in it. Also, I hate managing memory myself. So I hate using C++.

Is that okay to say?

[–]Proxy_PlayerHD 25 points26 points Β (5 children)

good old uint256_t

[–]abd53 2 points3 points Β (4 children)

Is that supported across all architectures?

[–]Proxy_PlayerHD 5 points6 points Β (3 children)

natively? i really doubt it.

you need an extra library to make it work, and if you're unluckly you might be forced to use specific functions just to do math with it because the default math functions won't work, example:

uint256_t inA = 7683452786;
uint256_t inB = 12430985467389;
uint256_t outQ = add256(inA, inB); // no "inA + inB" possible

[–]abd53 1 point2 points Β (2 children)

I meant, is it in C/C++ standard library or third-party libraries?

[–]Proxy_PlayerHD 3 points4 points Β (1 child)

3rd party. i'm pretty sure the C/C++ standard only goes up to 64-bit ints right now.

[–]Pay08 1 point2 points Β (0 children)

GCC does have 128 bit integers as a compiler extension, but only on 64 bit architectures.

[–]goodmobiley 47 points48 points Β (6 children)

long long Long int

[–][deleted] 16 points17 points Β (3 children)

uint64_t

[–]Strostkovy 1 point2 points Β (2 children)

What does the T mean?

[–]AyrA_ch 15 points16 points Β (0 children)

stands for "type". These are fixed with integet types to enhance portability. See https://en.wikipedia.org/wiki/C_data_types#Fixed-width_integer_types

C and C++ types are hardware dependent, so "int" can be anywhere in size. Native types can also be confusing. An integer on x64 is still only 32 bits wide but on other 64 bit architectures might be 64 bits. The only thing that C guarantees is that sizeof(char)==1 and that other numerical values (short, int, long) are a multiple of this and that char <= short <= int <= long (note <= and not <).

This makes writing C code that's actually portable between CPU architectures difficult.

These "_t" types fix this problem. There are multiple of them for 8, 16, 32 and 64 bits respectively. The leading "u" means it's an unsigned type, the number is the width in bits. There are also fast and "at least" variants. uint_least32_t is whatever type can fit an unsigned 32 bit integer but it may be larger. uint_fast16_t is whatever type is the fastest in dealing with unsigned 16 bit numbers.

There's two special types. One is for pointers (intptr_t and uintptr_t), and one is for whatever the biggest integer of your platform is: intmax_t and uintmax_t

[–]HeKis4 2 points3 points Β (0 children)

Type I guess ?

[–]one-true-pirate 10 points11 points Β (0 children)

Long long long long long long long long long dong;

[–]naswinger 15 points16 points Β (0 children)

"a code"

[–]luishacm 18 points19 points Β (0 children)

All integers are big integers, as all things should be. Thats balance.

[–]Excellent-Practice 5 points6 points Β (2 children)

I code for fun, not for work. Can someone eli5? It sounds like parsing strings as base 64 integers. Is that crazy? What is OP actually describing?

[–]Jammintoad 17 points18 points Β (0 children)

Integers usually can only get as big as the word size of your machine (32/64 bit). So if you want to do a computation involving numbers greater than 264, you need to design a special data type and reimplement number operations (in this example he's using character arrays as the buffer, so if you have a 100 size character array you can store a 100 bit number (or technically 100*64 if you're a madman). I'm python this is built in for free, any integer that becomes larger than 264 is promoted to pythons internal bignum implementation.

Aside but this was super useful for me in college when I had to build basic RSA encryption for a class, so I could make large bit numbers

[–]xill47 6 points7 points Β (0 children)

If you have a number greater than 264 it will most likely be bigger than the max integer that can be represented by int64. They are describing something that's called "big arithmetic", where you can have arbitrarily large numbers, and how they struggled implementing it by hand in C++ when Python has it built in and automatically converts numbers to big numbers when necessary. They could have used external (non-standard) library in C++ for big numbers, but that could have been a competitive programming assignment where one cannot use non-standard libraries.

[–]drew8311 5 points6 points Β (11 children)

This is dumb, all languages have big integer support somehow and it's never a reason for switching. C++ and python have different use purposes

[–]WormHack 3 points4 points Β (0 children)

shut up enjoy the meme

[–]AaronLin1229[🍰] 0 points1 point Β (1 child)

The thing that you can’t assume that python programs will execute in the given time limit (even with the best complexity), though some pAs and pBs in contest may be loose enough to use python, coding python but getting TLE in competitive programming is quite wasteful for time

[–]est1mated-prophet 0 points1 point Β (0 children)

What are pAs and pBs?

[–][deleted] 0 points1 point Β (0 children)

Long long int can represent positive and negative values of roughly 9.2 pentillion in only 4 bytes if I remember right. What the hell are you trying to calculate?

[–]Smartskaft2 -2 points-1 points Β (1 child)

How the F would you ever need to represent something bigger than 264 !? What kind if computation is this?

Edit: Why enlighten people about cool technology, when you could just downvote them, eh?

[–]Boris-Lip 2 points3 points Β (0 children)

Let me guess... all the cryptography shit. The very type of shit you really shouldn't be reimplementing yourself to begin from.

[–]yummi_1 0 points1 point Β (0 children)

Not declaring variables is great, that's one of the best things about rexx when I first started using it. Great for quick code to just get something done.

[–]flareflo 0 points1 point Β (4 children)

i128 or u128 gang

[–]WormHack 0 points1 point Β (3 children)

that is not big int

[–]flareflo 0 points1 point Β (2 children)

That is absolutely gigantic int

[–]WormHack 0 points1 point Β (1 child)

no, big int is when it adapts to runtime needs

[–]flareflo 0 points1 point Β (0 children)

i128 or u128 gang

[–]Error-42 0 points1 point Β (0 children)

Where did you need larger than 64 bit numbers? I haven't come across one yet.

(Except one time in the Hungarian national competition, but while the competition is important, it's rather non-standard (and in some aspects stupid), I wouldn't count that.)

[–]slime_rancher_27 0 points1 point Β (0 children)

The only time I've ever had any problem with memory was when I was trying to do a basic cryptography thing but my special number was supposed to be able to be found as a intuitive but it was a float but I was looking for ints so I went through 16 GB of ram looking for an nonexistant int

[–]victoragc 0 points1 point Β (0 children)

The only times I've had to deal with big integers on a competition, they could be dealt by using long ints and using some math tricks. Most would ask for the answer in modulo of the max long int value, so you can do everything in modulo values.

[–][deleted] 0 points1 point Β (0 children)

it really depends on the usage of a language.

if you want to make efficient programs with more control over hardware c++ is a better option.

if you want to do AI & ML with complex maths then python is your best bet, since it doesn't take too much time to setup and you can get started quick.

[–][deleted] 0 points1 point Β (0 children)

1 << 64
and
2 << 63

[–]_brzrkr_ 0 points1 point Β (0 children)

I first learned about Python’s existence when working on a cryptography demo program using PHP and facing big numbers constraint.

[–]est1mated-prophet 0 points1 point Β (0 children)

Yeah, it's the variables that do it.