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
Spatial
Nov 15, 2007

C is perfectly balanced for smug superiority. It being terrible is actually a great thing if you know it extremely well and can avoid the gotchas while looking down on the poor fools shooting their own feet constantly. It being terrible keeps you employed for life and gives you the status of being a respected expert. Thank goodness it's terrible! :v:

C++ is truly the ultimate successor to C when you think about it that way lol

Adbot
ADBOT LOVES YOU

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
As a professional C++ programmer, I have a lot of criticisms of the language, but the idea that it doesn’t effectively address any of the problems of C is pretty silly. You don’t get hard static guarantees, so yes, you can still write a one-liner that completely subverts the language. Nonetheless, if you use the basic tools the language gives you (destructors for resource management, lambdas for scoping), you can make large classes of bugs much harder to introduce by accident. That is valuable even if it’s imperfect.

ExcessBLarg!
Sep 1, 2001
I'd agree that disciplined, consistent use of a subset of C++ is safe, and maybe inherently safer than "conventional" C or C++. It's also true that disciplined, consistent use of C with modern APIs can also be done safely. There's a tradeoff in the overall complexity of the language (and perhaps the assembly generated by the compiler) and programmer convenience.

Both of those statements stand in contrast to something like Rust, for which safety was a fundamental point of design.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Spatial posted:

Simply do not make mistakes. A great strategy except that it never ever works and will never work.

The C language cannot fail, it can only be failed.

BigPaddy
Jun 30, 2008

That night we performed the rite and opened the gate.
Halfway through, I went to fix us both a coke float.
By the time I got back, he'd gone insane.
Plus, he'd left the gate open and there was evil everywhere.


C/C++ are great when people know what they are doing ergo we are doomed.

wolfman101
Feb 8, 2004

PCXL Fanboy
I am partial to “you need a testing team, but it should be rare for bugs to slip past your dev teams automated testing”

BigPaddy
Jun 30, 2008

That night we performed the rite and opened the gate.
Halfway through, I went to fix us both a coke float.
By the time I got back, he'd gone insane.
Plus, he'd left the gate open and there was evil everywhere.


Quickly followed by a hearty chuckle from all on the call and back to throwing in more scope by cutting dev time spent on automated tests.

more falafel please
Feb 26, 2005

forums poster

16 years and I've never worked on a project with automated testing beyond "run the game in attract mode overnight and fix the crash tomorrow"

Xarn
Jun 26, 2015

Tei posted:

These are outside the toolbox. You are going to build whatever using the tools inside the toolbox and undefined behaviors are whatever. You simply stay away from them. If you code depend on a undefined behavior, your code is kind of crap, even if your binary works.


I can never tell whether you are trolling or not.

Tei
Feb 19, 2011

Xarn posted:

I can never tell whether you are trolling or not.

I have bad opinions

Beef
Jul 26, 2004

rjmccall posted:

As a professional C++ programmer, I have a lot of criticisms of the language, but the idea that it doesn’t effectively address any of the problems of C is pretty silly. You don’t get hard static guarantees, so yes, you can still write a one-liner that completely subverts the language. Nonetheless, if you use the basic tools the language gives you (destructors for resource management, lambdas for scoping), you can make large classes of bugs much harder to introduce by accident. That is valuable even if it’s imperfect.

Yep. I am more confident in C++ than C that once my code compiles, it will run.

But, debugging C is piss-easy compared to C++. I've ripped out the C++ parts of compilation units and replaced the code with plain C in the quest to find bugs or performance issues.

wolfman101
Feb 8, 2004

PCXL Fanboy

more falafel please posted:

16 years and I've never worked on a project with automated testing beyond "run the game in attract mode overnight and fix the crash tomorrow"

Lol, well, I have seen what I would call a good test suite once or twice and also a few adequate ones. Then there is the vast wasteland.

smackfu
Jun 7, 2004

The classic logic applies here:

quote:

Some people, when confronted with a problem, think "I know, I'll use automated testing." Now they have two problems.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

smackfu posted:

The classic logic applies here:

Yeah but at least they understand one of them.

Bongo Bill
Jan 17, 2012

Good testing is possible and I hope you don't give up on trying to attain it.

Junkiebev
Jan 18, 2002


Feel the progress.

60 minutes into "the kubernetes cluster is broken - our app works fine", I ask to look at their code

code:
doathing(string input)
{
  try{BUNCH OF BUSINESS LOGIC}
  catch(exception e)
  {
     doathing(input);
     log(e.message);
  }
}
"Our logs don't show any errors"
:goonsay:

LET ME TELL YOU WHY, MY GOOD BITCH

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

more falafel please posted:

16 years and I've never worked on a project with automated testing beyond "run the game in attract mode overnight and fix the crash tomorrow"

This sounds like game dev, though, unless maybe possibly if you're writing the engine and plan to keep it around for a few years.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Volmarias posted:

This sounds like game dev, though, unless maybe possibly if you're writing the engine and plan to keep it around for a few years.

As someone whose worked in service games for most of my career, I can confirm. The thinking is emblematic of the older boxed game model, where code bases were often thrown away after the game launched.

Games can absolutely be put under test. I know because I've done it and seen it done. Unfortunately, the state of QA in the industry means this work isn't generally valued highly.

Successful games today have lifespans of a decade or more. They're effectively indistinguishable from a tech startup. The only reason some people in games think games can't be tested is because they don't exert any effort trying to or learning how to write code that's easy to test.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Junkiebev posted:

"Our logs don't show any errors"
:goonsay:

There isn't a court that wouldn't convict.

D34THROW
Jan 29, 2012

RETAIL RETAIL LISTEN TO ME BITCH ABOUT RETAIL
:rant:

Junkiebev posted:

60 minutes into "the kubernetes cluster is broken - our app works fine", I ask to look at their code

code:
doathing(string input)
{
  try{BUNCH OF BUSINESS LOGIC}
  catch(exception e)
  {
     doathing(input);
     log(e.message);
  }
}
"Our logs don't show any errors"
:goonsay:

LET ME TELL YOU WHY, MY GOOD BITCH

:stonk: You're putting one over on us right?




I want to believe :smithicide:

BigPaddy
Jun 30, 2008

That night we performed the rite and opened the gate.
Halfway through, I went to fix us both a coke float.
By the time I got back, he'd gone insane.
Plus, he'd left the gate open and there was evil everywhere.


If I make my logging unreachable then the app will never have errors. Genius.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

They didn't even see a stack overflow? :raise:

Ola
Jul 19, 2004

NihilCredo posted:

They didn't even see a stack overflow? :raise:

They did, and they tried googling to find out what that meant, but they just found a bunch of friendly explanations on how to implement fizzbuzz.

BigPaddy
Jun 30, 2008

That night we performed the rite and opened the gate.
Halfway through, I went to fix us both a coke float.
By the time I got back, he'd gone insane.
Plus, he'd left the gate open and there was evil everywhere.


NihilCredo posted:

They didn't even see a stack overflow? :raise:

I am not seeing the error I expect ergo it is an infrastructure problem.

Polio Vax Scene
Apr 5, 2009



Ticket resolved: Add ∞ memory to target machine to avoid stack overflow error

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Ola posted:

They did, and they tried googling to find out what that meant, but they just found a bunch of friendly explanations on how to implement fizzbuzz.

FizzBuzzEE once again shows the community its importance and value

Absurd Alhazred
Mar 27, 2010

by Athanatos
FizzBuzz.ai

wolfman101
Feb 8, 2004

PCXL Fanboy

Bongo Bill posted:

Good testing is possible and I hope you don't give up on trying to attain it.

This. Also, learn to love encapsulation and stateless functions if you want to get the most out of testing.

spiritual bypass
Feb 19, 2008

Grimey Drawer

Polio Vax Scene posted:

Ticket resolved: Add ∞ memory to target machine to avoid stack overflow error

This reminds me of a bad technical sales call I had once for web hosting product. The prospect said "whaddya mean it doesn't have unlimited disk space? Isn't this an enterprise offering??"

lifg
Dec 4, 2000
<this tag left blank>
Muldoon

Junkiebev posted:

60 minutes into "the kubernetes cluster is broken - our app works fine", I ask to look at their code

code:
doathing(string input)
{
  try{BUNCH OF BUSINESS LOGIC}
  catch(exception e)
  {
     doathing(input);
     log(e.message);
  }
}
"Our logs don't show any errors"
:goonsay:

LET ME TELL YOU WHY, MY GOOD BITCH

That reminds me of an internal software that I had to manage in my first job (a long time ago), and as I was reading it I realized that the programmer was learning to code while he wrote it.

The software had ten distinct steps, and in each step he was slowly getting better and better with errors. Like in step 1 he didn’t know that mysql_query() could fail. In step 2 he’d check mysql_error(), but literally ignore it. In step 3, he’d echo the error to the screen, but would just continue to the next step. In step 4 he’d check for an error, and if one happened he’d just try again, and this time he wouldn’t check for an error.

Frankly it was a work of art. I wish I’d preserved it.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

wolfman101 posted:

This. Also, learn to love encapsulation and stateless functions if you want to get the most out of testing.

Stateless is the way. I don't understand why every classroom I ever attended tried teaching me object oriented.

chglcu
May 17, 2007

I'm so bored with the USA.

rjmccall posted:

As a professional C++ programmer, I have a lot of criticisms of the language, but the idea that it doesn’t effectively address any of the problems of C is pretty silly. You don’t get hard static guarantees, so yes, you can still write a one-liner that completely subverts the language. Nonetheless, if you use the basic tools the language gives you (destructors for resource management, lambdas for scoping), you can make large classes of bugs much harder to introduce by accident. That is valuable even if it’s imperfect.

Also as a more and more frequently intoxicated professional C++ programmer, destructors and RAII are overrated. Just write your free immediately after you write your malloc, you lazy poo poo. Only being semi-ironic here. Memory management just really isn’t that hard. I’m increasingly of the opinion that the C problems C++ does address just aren’t worth the other bullshit it brings to to the table.

Also, my recent experiences have turned me off of lambdas completely. Debugging them multiple levels deep is a massive rear end-ache.

TBF, the codebase I’ve been working in for the past year is a huge pile of poo poo, which has soured me on C++ even more, though I was already turning against it before.

BigPaddy
Jun 30, 2008

That night we performed the rite and opened the gate.
Halfway through, I went to fix us both a coke float.
By the time I got back, he'd gone insane.
Plus, he'd left the gate open and there was evil everywhere.


Nolgthorn posted:

Stateless is the way. I don't understand why every classroom I ever attended tried teaching me object oriented.

Because those who write the class plans are not following industry trends or are just stuck in their ways. For example when I was at College in the UK (optional equivalent to US Highschool) doing a general IT/Programming course one of the lecturers would only teach COBOL. He was told to teach web applications as his current lesson plan wasn’t keeping up with the world so he just wrote a new lesson plan that was COBOL for web applications… and was promptly fired.

smackfu
Jun 7, 2004

wolfman101 posted:

This. Also, learn to love encapsulation and stateless functions if you want to get the most out of testing.

Most of the testing that people complain about is automated integration testing and I don’t know how stateless applies there.

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

chglcu posted:

Also as a more and more frequently intoxicated professional C++ programmer, destructors and RAII are overrated. Just write your free immediately after you write your malloc, you lazy poo poo. Only being semi-ironic here. Memory management just really isn’t that hard. I’m increasingly of the opinion that the C problems C++ does address just aren’t worth the other bullshit it brings to to the table.

Also, my recent experiences have turned me off of lambdas completely. Debugging them multiple levels deep is a massive rear end-ache.

TBF, the codebase I’ve been working in for the past year is a huge pile of poo poo, which has soured me on C++ even more, though I was already turning against it before.

memory management in c++ only gets hard if you go whole hog in on the oop bullshit. once you get to the point where reference counting and shared_ptr seem like a good solution for the problem you're having, you've hosed.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Bruegels Fuckbooks posted:

memory management in c++ only gets hard if you go whole hog in on the oop bullshit. once you get to the point where reference counting and shared_ptr seem like a good solution for the problem you're having, you've hosed.

How is reference counting "oop bullshit"? I realize the definition is somewhat nebulous but oop doesn't mean "thing I dislike".

Presto
Nov 22, 2002

Keep calm and Harry on.

chglcu posted:

Memory management just really isn’t that hard. I’m increasingly of the opinion that the C problems C++ does address just aren’t worth the other bullshit it brings to to the table.

I'm a battle-scarred old C programmer, and I will happily take smart pointers, because then the memory gets released automatically and that's one less thing I have to think about.

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

pokeyman posted:

How is reference counting "oop bullshit"? I realize the definition is somewhat nebulous but oop doesn't mean "thing I dislike".

The pattern for shared pointer is "oh wait, this class is owned by multiple other classes, how do I deal with that?" That's OOP as gently caress, storing unnecessary poo poo as members.

more falafel please
Feb 26, 2005

forums poster

Presto posted:

I'm a battle-scarred old C programmer, and I will happily take smart pointers, because then the memory gets released automatically and that's one less thing I have to think about.

You still have to think about it, you just think about it differently. If you use smart pointers wrong, they can still leak, dangle, use-after-free, double-free, etc. There's no strategy for resource management that just means you don't have to think about resource management anymore.

Adbot
ADBOT LOVES YOU

FlapYoJacks
Feb 12, 2009
Just lol if valgrind isn't part of your CI/CD.
Double lol if you don't have CI/CD

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