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
Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
why the chair

Adbot
ADBOT LOVES YOU

Eggnogium
Jun 1, 2010

Never give an inch! Hnnnghhhhhh!
What you’ve never hosed in a chair??

Ola
Jul 19, 2004

Pass by value = Debbie doesn't swallow
Pass by reference = Debbie swallows

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.

maybe c...hair?

Khorne
May 1, 2002

Ola posted:

Pass by value = Debbie doesn't swallow
Pass by reference = Debbie swallows
you got it backward...

Ola
Jul 19, 2004

Khorne posted:

you got it backward...

Have I? If she spits returns my parameter back at me, clearly it's been modified in some way. Or hmm, perhaps pass by value can be seen as the used parameter is now gone and we will never see it again, ok I can go with that.

Khorne
May 1, 2002

Ola posted:

Have I? If she spits returns my parameter back at me, clearly it's been modified in some way. Or hmm, perhaps pass by value can be seen as the used parameter is now gone and we will never see it again, ok I can go with that.
I just wanted to make a joke.

Khorne fucked around with this message at 20:04 on Jul 24, 2018

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
stop

boo_radley
Dec 30, 2005

Politeness costs nothing
Pull up thread

VikingofRock
Aug 24, 2008





Agreed. That sort of thing is a coding horror because it makes programming more of a boy's club and creates a really uncomfortable working environment (especially for women). Posting it was enough; we don't have to workshop the jokes and propagate those problems to our forums.

Toady
Jan 12, 2009

Also, it's not even funny

Coffee Mugshot
Jun 26, 2010

by Lowtax
Shout outs to my boy slowbeef for revealing another coding horror hidden within the thread

Ola
Jul 19, 2004

I realize, relent and apologize. As the world of porn should do to Debbie.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

return0 posted:

I ask for a couple of reasons:

1. I used to do it in work emails often. A buddy of mine told me to stop as it came over as being tentative and unsure, despite this not being the case. I now try to force myself to write more tersely. I’m interested in if you’ve had the same feedback or experience?

2. When phone lurking, I zoom on the posts and don’t see the username or avatars. I don’t often recognise posters by their writing style in CoC. I did however recognise your post due to the parentheses, which piqued my curiosity.

Sorry for not responding, last couple of days have been busy.

No, no-one has ever said anything like that to me. I am definitely the most wordy person where I work, at least in written communication, but nobody brings that up in either a positive or negative light.

Toward the end of last year I was leading a project where the contact on the customer side was an individual who several members of my company have had previous experience of dealing with. I am not going to say that this person is stupid, but they are somewhat officious and not technically-oriented. I would say that this person sees it as their job to write emails to people and be seen to write emails to people, and they are quite good at this. Anyway I spent a larger than expected proportion of my time on that project managing this person and patiently responding to their emails and explaining why this or that thing was not a problem. Now you might question whether that's a good use of resources or not, but I think the other people who were involved in the project were mostly pretty happy that I was doing this and that they therefore did not usually have to deal with this person's emails. So I suspect my mode of patiently verbose written communication is seen as something that has its uses from time to time.

I'm surprised and glad to know that my bad posting somehow makes an impression on people.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe
I often find myself including lots of parentheticals in my writing. When I notice it, I try to see if there's a better way to rephrase things. Often what I'm actually doing is just stringing together a lot of semi-related thoughts into a single sentence, using parentheses and conjunctions to avoid bringing things to a stop. This is not the best way to write. Like with Twain's complaints about German (where by the time you've gotten to the verb you've lost track of what the beginning of the word was about), you don't want all of your sentences to be paragraphs in their own right. Give the reader a chance to breathe from time to time.

tl;dr writing is hard.

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
good writing is unequal writing

the modality in which it is unequal is up to you

Thermopyle
Jul 1, 2003

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

TooMuchAbstraction posted:

I often find myself including lots of parentheticals in my writing. When I notice it, I try to see if there's a better way to rephrase things. Often what I'm actually doing is just stringing together a lot of semi-related thoughts into a single sentence, using parentheses and conjunctions to avoid bringing things to a stop. This is not the best way to write. Like with Twain's complaints about German (where by the time you've gotten to the verb you've lost track of what the beginning of the word was about), you don't want all of your sentences to be paragraphs in their own right. Give the reader a chance to breathe from time to time.

tl;dr writing is hard.

You are me.

Sometimes I'll come across something I wrote in the past and I cringe at all the parentheses and commas. Thats not the only reason I cringe at what I've wrote in the past, but its the reason relevant to this discussion. :)

Good Will Hrunting
Oct 8, 2012

I changed my mind.
I'm not sorry.

Thermopyle posted:


Sometimes I'll come across something I wrote in the past and I cringe at all the parentheses and commas. Thats not the only reason I cringe at what I've wrote in the past, but its the reason relevant to this discussion. :)

N.B.: Indeed, I largely dislike the way people who think they are remarkably intelligent (e.g. my ex-VP (i.e. one of the smartest people in the world) from my last job) generally write comments. When writing, say, a JIRA ticket, it follows that everything will be remarkably formal to the point of passive-aggression.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
are you guys surprised programmers use parentheses a lot?

FlapYoJacks
Feb 12, 2009
I have to keep denying pull requests because people try to introduce code that doesn't pass clang-tidy.

I get that C++17 is new, but clang-tidy supports it, it's built into CLion, and it's marked with giant yellow warnings. Feel free to not submit code that has new warnings all over the place.

Also other rant:

Low level C programmers that treat C++ like C with classes are the absolute worst.

Managing their own memory? Check
Char pointers and char arrays? Check
Trying to write their own god damned libraries for everything? Check.

It's a modern C++ Linux project, please for the love of god treat it as such!

The Fool
Oct 16, 2003


To be honest; I'm surprised typos like this aren't more common;

jerry seinfel
Jun 25, 2007


I'm arguing with a vendor at work. They process an XML file we generate with a different software package. The vendor's system breaks it into separate, smaller XML files, to import into their database

Each element in the main file has like a node like <RevVersion>20</RevVersion> that is incremented whenever that element is edited in the software. So on the vendor's end they're trying to parse it but are running into issues where
code:
element is invalid - The value '270' is invalid according to its datatype 'Byte' - The string '270' is not a valid SByte value.
The rep sent me the error log that has a ton of these and I noticed, hey, these are all over 127 so this is probably a stupid integer thing. So I dig up the .NET documentation on SByte and wow I was right, it's an 8bit signed int that's being used to store a value which should never be <0 and has no upper bound

The vendor is trying to tell me that sbyte means string.

Eggnogium
Jun 1, 2010

Never give an inch! Hnnnghhhhhh!
Rev all the data until it’ll all above 127. You know, out of sbyte.

Khorne
May 1, 2002

ratbert90 posted:

Low level C programmers that treat C++ like C with classes are the absolute worst.

Managing their own memory? Check
Char pointers and char arrays? Check
Trying to write their own god damned libraries for everything? Check.

It's a modern C++ Linux project, please for the love of god treat it as such!
This is a legitimate use of C++, but it doesn't sound appropriate for your project or the portion of it he submitted. I don't get why people complain about it all the time like you should never do it. There are many subsets of C++ that are valid for different uses. Well, except for "writing your own libraries for everything". That's somewhat useful as a learning activity for certain data structures or algorithms, but it's usually better to grab something that exists unless your project has very specific needs.

If you really want to troll open source C++ projects submit "C but functional programming". Did you know you can implement tail call optimization in a handful of lines?

Khorne fucked around with this message at 23:50 on Jul 25, 2018

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.

Khorne posted:

This is a legitimate use of C++, but it doesn't sound appropriate for your project. I don't get why people complain about it all the time like you should never do it.

If you really want to troll open source C++ projects submit "C but functional programming". Did you know you can implement tail call optimization in around 4-6 lines?

you can write all the old school c++ you want if you don't gently caress up and introduce memory leaks, oh wait, not going to happen.

Foxfire_
Nov 8, 2010

Bruegels Fuckbooks posted:

you can write all the old school c++ you want if you don't gently caress up and introduce memory leaks, oh wait, not going to happen.



(Also a totally valid use of C++ in lots of embedded environments)

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Khorne posted:

This is a legitimate use of C++, but it doesn't sound appropriate for your project or the portion of it he submitted. I don't get why people complain about it all the time like you should never do it. There are many subsets of C++ that are valid for different uses.

There are all sorts of things you can cut out of your C++ Experience™ and still be a reasonable C++ programmer — exceptions, RTTI, complex inheritance, heavy template use, virtual dispatch, heap allocation, and so on — but I have zero reservations about saying that if you're not using classes with constructors and destructors to encapsulate data, preserve invariants, and manage resources, you are just a bad programmer and you should learn to be better.

Loezi
Dec 18, 2012

Never buy the cheap stuff

Eggnogium posted:

You know, out of sbyte.

This caused me to attempt some sort of a combined grunt and chuckle, I'm not sure which is more apt.

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man

rjmccall posted:

There are all sorts of things you can cut out of your C++ Experience™ and still be a reasonable C++ programmer — exceptions, RTTI, complex inheritance, heavy template use, virtual dispatch, heap allocation, and so on — but I have zero reservations about saying that if you're not using classes with constructors and destructors to encapsulate data, preserve invariants, and manage resources, you are just a bad programmer and you should learn to be better.

Doesn't not using exceptions cause issues with constructors that can fail and thereby break some idioms like RAII

fake e: I mean I guess that's not that big of a drawback but I'm in the camp that anything that makes it harder to google stuff is a misuse of the language

Xarn
Jun 26, 2015
Factories.

Coffee Mugshot
Jun 26, 2010

by Lowtax

Phobeste posted:

Doesn't not using exceptions cause issues with constructors that can fail and thereby break some idioms like RAII

fake e: I mean I guess that's not that big of a drawback but I'm in the camp that anything that makes it harder to google stuff is a misuse of the language

That makes it harder to google stuff? I have a feeling many of the issues I see with people's C++ code is because they spent too long on Google and too little on formal logic.

Khorne
May 1, 2002

rjmccall posted:

There are all sorts of things you can cut out of your C++ Experience™ and still be a reasonable C++ programmer — exceptions, RTTI, complex inheritance, heavy template use, virtual dispatch, heap allocation, and so on — but I have zero reservations about saying that if you're not using classes with constructors and destructors to encapsulate data, preserve invariants, and manage resources, you are just a bad programmer and you should learn to be better.
I just assumed they were manually doing memory stuff in the constructor, destructor, and other relevant parts of the class. My interpretation of "C with classes" is more C++ without the stl and with some bias toward doing things in a verbose C way when C++ has more concise language features.

I get what what people are complaining about now if people actually do what you outlined. I also get complaining about what I described above if it's in software where you absolutely should be using the stl and writing code in a way that the rest of the project is written.

Khorne fucked around with this message at 16:57 on Jul 26, 2018

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Phobeste posted:

Doesn't not using exceptions cause issues with constructors that can fail and thereby break some idioms like RAII

fake e: I mean I guess that's not that big of a drawback but I'm in the camp that anything that makes it harder to google stuff is a misuse of the language

It just means you either build things with factories, which you might want to do anyway, or you have a null state in your class, which you also might want to do anyway.

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man

rjmccall posted:

It just means you either build things with factories, which you might want to do anyway, or you have a null state in your class, which you also might want to do anyway.

Fair enough on this

Coffee Mugshot posted:

That makes it harder to google stuff? I have a feeling many of the issues I see with people's C++ code is because they spent too long on Google and too little on formal logic.

But with this (and a bit towards rjmccall), what I really meant is that a lot of c++ "best practice" stuff - that you'll see recommended very frequently and by reasonable people to listen to - relies on having all these things. For instance, STL locks want to use RAII, implicitly relying on exceptions. While you're free to try and avoid writing complex templates, you still might get stuck with things like that vector<bool> "optimization" (which I know is not required but is a possibility).

It is kind of cool though that you can use C++ and most of the STL without ever doing heap allocation (in the sense of using malloc() or dynamic allocation with sbrk() anyway, you'll usually be implementing a slab allocator or object pool on the free store) by using custom allocators. That's the upside of C++s fanatical adherence to pay-as-you-go.

b0lt
Apr 29, 2005

Phobeste posted:

But with this (and a bit towards rjmccall), what I really meant is that a lot of c++ "best practice" stuff - that you'll see recommended very frequently and by reasonable people to listen to - relies on having all these things. For instance, STL locks want to use RAII, implicitly relying on exceptions.

RAII doesn't rely on exceptions at all, you have your dependency arrow pointing the wrong way. Exceptions rely on RAII, because otherwise, every single function that does any sort of manual cleanup would need to wrap everything that could throw in a try block, clean up, and rethrow.

repiv
Aug 13, 2009

https://twitter.com/chordbug/status/1022516369433276416
https://twitter.com/chordbug/status/1022517666509205504

repiv fucked around with this message at 19:12 on Jul 26, 2018

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
having just done quite a lot of cpu profiling & optimization, i'm baffled at my complete inability to guess both what a compiler will emit and what's actually fast on device.

like, i turned a recursive algorithm into an iterative one. 9ms to 0.2ms.

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man

b0lt posted:

RAII doesn't rely on exceptions at all, you have your dependency arrow pointing the wrong way. Exceptions rely on RAII, because otherwise, every single function that does any sort of manual cleanup would need to wrap everything that could throw in a try block, clean up, and rethrow.

Well then they're definitely reliant on each other because if you don't have exceptions, RAII requires having some query to see if an error occurs like doing

code:
std::mutex m;
std::lock_guard lg(m);
if (lg.is_locked()) { 
  do_thing();
} else {
  do_error();
}
which, minor difference or not, is exactly what the RAII idiom is supposed to let you avoid

streetlamp
May 7, 2007

Danny likes his party hat
He does not like his banana hat

Adbot
ADBOT LOVES YOU

Apex Rogers
Jun 12, 2006

disturbingly functional

Suspicious Dish posted:

having just done quite a lot of cpu profiling & optimization, i'm baffled at my complete inability to guess both what a compiler will emit and what's actually fast on device.

like, i turned a recursive algorithm into an iterative one. 9ms to 0.2ms.

Why would you expect recursion to be more efficient than iteration? Function calling overhead for each loop element tends to slow things down. Am I missing something?

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