Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Sweeper
Nov 29, 2007
The Joe Buck of Posting
Dinosaur Gum

Sapozhnik posted:

c++: where the most obvious answer to every question is always wrong

if you're doing a side project try rust instead, c++ is a loving garbage fire

ive got some stuff going in rust, it just isn't grabbing me atm so i moved over to c++ as suicide is too painful

Adbot
ADBOT LOVES YOU

sarehu
Apr 20, 2007

(call/cc call/cc)
There's no crying in C++. Template errors aren't actually hard if you're literate and can look at line numbers. And acclimate a bit.

Guacamayo
Feb 2, 2012
Thank you guys, Im gonna check those books out!

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Sapozhnik posted:

c++: where the most obvious answer to every question is always wrong
the most obvious answer is "to maintain C compatibility" and is usually right

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
other obvious, and usually correct answers to C++ quandries:
- "it helps the compiler generate fast code"
- "because memory is an array of bytes"

it's bad that modern c++ pushes you into template poo poo from the first day because C++ wihtout templates is p. straightforward to learn

Gazpacho fucked around with this message at 04:29 on May 17, 2017

Bloody
Mar 3, 2013

rust is a bazillion times better and if you're writing greenfield c++ ityool 2017 you are loving up bad

Arcsech
Aug 5, 2008

Bloody posted:

rust is a bazillion times better and if you're writing greenfield c++ ityool 2017 you are loving up bad

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
i'm finding work so ... no, not loving up

Sapozhnik
Jan 2, 2005

Nap Ghost
i mean some ppl have to suck dick for money

or write php

doing c++? could be worse i guess

ulmont
Sep 15, 2010

IF I EVER MISS VOTING IN AN ELECTION (EVEN AMERICAN IDOL) ,OR HAVE UNPAID PARKING TICKETS, PLEASE TAKE AWAY MY FRANCHISE

Bloody posted:

rust is a bazillion times better and if you're writing greenfield c++ ityool 2017 you are loving up bad

I think I'd rather write C99 than greenfield C++.

Bloody
Mar 3, 2013

ulmont posted:

I think I'd rather write C99 than greenfield C++.

same but C11 is a thing now and newer = better than

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Bloody posted:

same but C11 is a thing now and newer = better than



lmao

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
most of the deep problems of c++, like unsafe pointers and manual memory management, are there in c. c is a simpler language, so those problems are more obvious in your code, but that simplicity also means you can't really do anything about them, so they stay obvious in your code. c++ gives you the basic tools to try to fix most of those problems, and they actually compose pretty nicely, but there are holes in the model that you just have to individually learn about and internalize how to avoid. once you've done that, which is annoying but not actually all that difficult especially if you have any experience with those problems from c, c++ is just massively superior in almost every way except compile time. it is painful to write even a moderately complex program in c because the language gives you almost no tools for abstraction or encapsulation, so either everything turns into a giant unmaintainable mess or you start writing your own opaque type system with bespoke idioms for namespacing and initialization and destruction and memory management, all of which of course has to be manually enforced, and then you start taking the next logical step and wrapping more stuff in macros and you've lost all of that theoretical simplicity and obviousness and certainly all sense of perspective and when any of it blows up you're instantly elbows-deep in the debugger which can't even give you a meaningful line number because of all your macros but by god at least you're not one of those filthy c++ programmers who are happily writing well-abstracted value types with constructors and destructors and methods and private state, because dontcha know it's all bullshit because the language will just let you return a reference to a local variable without even a warning (because you've turned off all the warnings, you're a c programmer goddamnit) and how would you ever know that that's a problem

anyway rust is basically c++ with weird syntax except it makes everything unsafe a hard compiler error. but it still strongly pushes you towards c/c++-like idioms like "it's totally safe to return an interior pointer here because i know the outer memory is still valid" except that it forces you to prove that that's true at compile time which you can only do by repeatedly ritually impaling yourself on the dull blade of the borrow checker until you have mastered the sacred precepts of the nine-fold nested lifetimes

Workaday Wizard
Oct 23, 2009

by Pragmatica
eh... lifetimes are easy

e: more accuratly: theyre straightforward

VikingofRock
Aug 24, 2008




even C++ experts get confused about the syntax

spiritual bypass
Feb 19, 2008

Grimey Drawer
why doesn't C have namespaces, that would be cool

Cybernetic Vermin
Apr 18, 2005

rt4 posted:

why doesn't C have namespaces, that would be cool

because the simple and stable abi is one of the things which is keeping c relevant

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
c has namespaces. just prepend every symbol with _______MY_BUTT____NAMESPACE__

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
if that clashes, add more underscores

gonadic io
Feb 16, 2011

>>=
Rust is c++ without 30 years of baggage. It's not visionary imo, in the space of non-vm langs. in the last few years of new langs what's it competing with? Go, and D?

Berious
Nov 13, 2005
i thought rust was a game about swinging dongers

Flat Daddy
Dec 3, 2014

by Nyc_Tattoo

Berious posted:

i thought rust was a game about swinging dongers

under patriarchy, everything is about swinging dongers

30 TO 50 FERAL HOG
Mar 2, 2005



just went to download vs2017 and lol they no longer support iso installations, if you want to do an offline installation you have to do a bunch of dumb poo poo including installing a lot of certificates lmao

https://docs.microsoft.com/en-us/visualstudio/install/install-visual-studio-in-offline-environment

gj microsoft

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
Every struct type in C is a namespace

Bloody
Mar 3, 2013

gonadic io posted:

Rust is c++ without 30 years of baggage. It's not visionary imo, in the space of non-vm langs. in the last few years of new langs what's it competing with? Go, and D?

is D that new? and does literally anybody use it?

Sapozhnik
Jan 2, 2005

Nap Ghost

rjmccall posted:

most of the deep problems of c++, like unsafe pointers and manual memory management, are there in c. c is a simpler language, so those problems are more obvious in your code, but that simplicity also means you can't really do anything about them, so they stay obvious in your code. c++ gives you the basic tools to try to fix most of those problems, and they actually compose pretty nicely, but there are holes in the model that you just have to individually learn about and internalize how to avoid. once you've done that, which is annoying but not actually all that difficult especially if you have any experience with those problems from c, c++ is just massively superior in almost every way except compile time. it is painful to write even a moderately complex program in c because the language gives you almost no tools for abstraction or encapsulation, so either everything turns into a giant unmaintainable mess or you start writing your own opaque type system with bespoke idioms for namespacing and initialization and destruction and memory management, all of which of course has to be manually enforced, and then you start taking the next logical step and wrapping more stuff in macros and you've lost all of that theoretical simplicity and obviousness and certainly all sense of perspective and when any of it blows up you're instantly elbows-deep in the debugger which can't even give you a meaningful line number because of all your macros but by god at least you're not one of those filthy c++ programmers who are happily writing well-abstracted value types with constructors and destructors and methods and private state, because dontcha know it's all bullshit because the language will just let you return a reference to a local variable without even a warning (because you've turned off all the warnings, you're a c programmer goddamnit) and how would you ever know that that's a problem

anyway rust is basically c++ with weird syntax except it makes everything unsafe a hard compiler error. but it still strongly pushes you towards c/c++-like idioms like "it's totally safe to return an interior pointer here because i know the outer memory is still valid" except that it forces you to prove that that's true at compile time which you can only do by repeatedly ritually impaling yourself on the dull blade of the borrow checker until you have mastered the sacred precepts of the nine-fold nested lifetimes

maybe it's different inside apple idk, i haven't come across any major open source c projects that abuse preprocessor macros to that extent. and who the hell writes production c code with warnings turned off? :psyduck:

c++'s bullshit does not mesh well at all, it is the next most godawfully misdesigned language next to php. it's one long bloody trail of badly thought out ideas and unforseen interactions between them whose consequences were hastily worked around only to create even more consequences to be worked around. i'd much rather have a bunch of error handling boilerplate in plain old c than have to deal with manual memory management and exceptions in the same language.

netcat
Apr 29, 2008

Bloody posted:

is D that new? and does literally anybody use it?

D is about 20 years old iirc, and no

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

Gazpacho posted:

Every struct type in C is a namespace

every pair of curly braces in C is a namespace

:shepface:

gonadic io
Feb 16, 2011

>>=

Berious posted:

i thought rust was a game about swinging dongers

over 1% of posts on /r/rust are about the game (whose subreddit is /r/playrust)

gonadic io
Feb 16, 2011

>>=

Bloody posted:

is D that new? and does literally anybody use it?

idk i'm just spitballing here.

Mao Zedong Thot
Oct 16, 2008


no one uses d, it doesn't compete with anything

go competes with c++ for 50% of what c++ does, the other 50% remains c/c++ territory

pretty sure rust is just a troll of c++ folks, not that I've written a line of it

ynohtna
Feb 16, 2007

backwoods compatible
Illegal Hen
nothing can troll c++ folks more than c++

Xarn
Jun 26, 2015

rjmccall posted:

most of the deep problems of c++, like unsafe pointers and manual memory management, are there in c. c is a simpler language, so those problems are more obvious in your code, but that simplicity also means you can't really do anything about them, so they stay obvious in your code. c++ gives you the basic tools to try to fix most of those problems, and they actually compose pretty nicely, but there are holes in the model that you just have to individually learn about and internalize how to avoid. once you've done that, which is annoying but not actually all that difficult especially if you have any experience with those problems from c, c++ is just massively superior in almost every way except compile time. it is painful to write even a moderately complex program in c because the language gives you almost no tools for abstraction or encapsulation, so either everything turns into a giant unmaintainable mess or you start writing your own opaque type system with bespoke idioms for namespacing and initialization and destruction and memory management, all of which of course has to be manually enforced, and then you start taking the next logical step and wrapping more stuff in macros and you've lost all of that theoretical simplicity and obviousness and certainly all sense of perspective and when any of it blows up you're instantly elbows-deep in the debugger which can't even give you a meaningful line number because of all your macros but by god at least you're not one of those filthy c++ programmers who are happily writing well-abstracted value types with constructors and destructors and methods and private state, because dontcha know it's all bullshit because the language will just let you return a reference to a local variable without even a warning (because you've turned off all the warnings, you're a c programmer goddamnit) and how would you ever know that that's a problem

This expresses my frustration with C programmers much better than I've ever been able to.

I swear, if I hear from C programmer one more time combination of "its beautifully simple language", "well you can hide that in macros" and "It took me the entire day in debugger to find the bug" :argh:

crazypenguin
Mar 9, 2005
nothing witty here, move along
For my own purposes I've found C + Python to be a better option than C++, but I know some applications call for all-native code.

I've watched Rust and it looks okay, but I haven't had an opportunity to use it in anger yet.

The thing that annoys me about C++ besides the compile times and the landmines in the language design is the difficulty of controlling ABIs, symbol visibility, and linking.

like, C++ programmers are still doing "pImpl"s right? I don't know that anything has changed that would removed that bullshit. But I've successfully avoided having to do C++ for the last 10 years, so who knows! :)

Sapozhnik
Jan 2, 2005

Nap Ghost

crazypenguin posted:

But I've successfully avoided having to do C++ for the last 10 years, so who knows! :)

same, it's really cool

e: to clarify, i used to do c++. i no longer do c++. also it's more like seven years clean and off the crack but hey, close enough

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell


i'm but a programming child compared to many of you, but i've recently gone down this path and its pretty fuckin' fantastic so far

Shaggar
Apr 26, 2006

BiohazrD posted:

just went to download vs2017 and lol they no longer support iso installations, if you want to do an offline installation you have to do a bunch of dumb poo poo including installing a lot of certificates lmao

https://docs.microsoft.com/en-us/visualstudio/install/install-visual-studio-in-offline-environment

gj microsoft

you are doing an offline install which means you wont be able to get those certificates from the internet which is how it normally happens

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

crazypenguin posted:

For my own purposes I've found C + Python to be a better option than C++, but I know some applications call for all-native code.

I've watched Rust and it looks okay, but I haven't had an opportunity to use it in anger yet.

The thing that annoys me about C++ besides the compile times and the landmines in the language design is the difficulty of controlling ABIs, symbol visibility, and linking.

like, C++ programmers are still doing "pImpl"s right? I don't know that anything has changed that would removed that bullshit. But I've successfully avoided having to do C++ for the last 10 years, so who knows! :)

if you want a stable abi in c++, yeah, you have to do pImpl-like stuff. this is also true in c, you can't expose a struct definition in c and expect to maintain binary stability. it's a pretty simple set of rules to follow in both languages, if you're changing types or function signatures in your public headers you're probably in trouble

ofc that's a feature that most languages either don't provide at all or have similar problems with, like even with a jit in java you can change the fields of a class but you certainly can't change any method signatures

crazypenguin
Mar 9, 2005
nothing witty here, move along

rjmccall posted:

if you want a stable abi in c++, yeah, you have to do pImpl-like stuff. this is also true in c, you can't expose a struct definition in c and expect to maintain binary stability.

I suppose that's mostly true. When you put it this way, I guess maybe "shared_ptr" is actually a change that kinda obsoletes pImpl, by encouraging people do do things the C-style "just use a pointer" way instead of wanting a old-style C++ "let's pretend this is allocated on the stack to get automatic memory management, but really it's just a pImpl."

I've long since forgotten the rules about how vtables get laid out, though. (Probably implementation defined.) ABI compat is still a huge pain because of that. Sure in Java you can't change the method signature, but you can freely add new methods! Has anything improved that situation?

Adbot
ADBOT LOVES YOU

Dylan16807
May 12, 2010

Shaggar posted:

you are doing an offline install which means you wont be able to get those certificates from the internet which is how it normally happens

and the automated certificate installer can't be supplied from a folder because?

that link gives a non-answer.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply