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

Notorious b.s.d. posted:

it's a hack layered on hacks. hacks all the way down

much like your posting!!!!!!!!!!

Adbot
ADBOT LOVES YOU

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

hackbunny posted:

mutable vs immutable is done really well in Objective C and with very low overhead

no it doesn't, it sucks, you have to defensively copy all over the place. it would be okay if the mutable types weren't subtypes of the immutable ones but they are

value semantics with copy-on-write and a language that actually does obvious value propagation optimizations for you is the right solution

and that's intelligent about when you're mutating an l-value

copy-on-write is incredibly frustrating in C++ with any sort of convenient interface because the language doesn't consider how an l-value is used. oh you have a vector variable and you're subscripting into it to read element 0, well technically that subscript operator returns a non-const l-value so you can assign into it which you aren't doing, let me just proactively copy the entire vector for you

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

b0lt posted:

__attribute__(((((((((((((((format(printf,1,2))
i wonder why they numbered from 1 for this

0 is reserved to mean "no argument", as in, no argument is the "...". in that case the compiler does a syntax check, but not a type check. it's meant mainly for vprintf

e: I think the extra parentheses are so that __attribute__ can be defined as a macro taking a single argument

hackbunny fucked around with this message at 23:27 on Mar 11, 2015

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

rjmccall posted:

no it doesn't, it sucks, you have to defensively copy all over the place. it would be okay if the mutable types weren't subtypes of the immutable ones but they are

really? well I love it and I love defensive programming. maybe it's because I don't use ARC (don't ask), but remembering to use copy instead of retain isn't a huge effort. and if I need to know whether a class is mutable or immutable I only have to look at its protocols

rjmccall posted:

copy-on-write is incredibly frustrating in C++ with any sort of convenient interface because the language doesn't consider how an l-value is used. oh you have a vector variable and you're subscripting into it to read element 0, well technically that subscript operator returns a non-const l-value so you can assign into it which you aren't doing, let me just proactively copy the entire vector for you

I'm pretty sure I tried and failed to do it, but, can't you return some kind of proxy object instead of a reference, in that case?

e: wasn't this already brilliantly solved in vector<bool>? :v:

Sapozhnik
Jan 2, 2005

Nap Ghost

this is loving brilliant, thank you for sharing this

b0lt
Apr 29, 2005

hackbunny posted:

0 is reserved to mean "no argument", as in, no argument is the "...". in that case the compiler does a syntax check, but not a type check. it's meant mainly for vprintf

e: I think the extra parentheses are so that __attribute__ can be defined as a macro taking a single argument

oh, i forgot that the versions that took va_list existed

extra parens are so you can macro them out on other compilers without having to use ...

VikingofRock
Aug 24, 2008




HappyHippo posted:

when was the last time you got burned by a printf type error? how much time did it take to track down and fix?

agreed, no one ever gets bitten by printf errors

b0lt
Apr 29, 2005

i'm pretty sure that literally every single compiler has a non-constant format string warning, and if you're compiling without -Wall -Werror or equivalent you deserve what you get

VikingofRock
Aug 24, 2008




b0lt posted:

i'm pretty sure that literally every single compiler has a non-constant format string warning, and if you're compiling without -Wall -Werror or equivalent you deserve what you get

sure, they aren't common anymore but they definitely still happen

pseudorandom name
May 6, 2007

b0lt posted:

i'm pretty sure that literally every single compiler has a non-constant format string warning, and if you're compiling without -Wall -Werror or equivalent you deserve what you get

-Wall doesn't include -Wformat-security

compuserved
Mar 20, 2006

Nap Ghost

pseudorandom name posted:

-Wall doesn't include -Wformat-security

i'm "all" not meaning all

b0lt
Apr 29, 2005

pseudorandom name posted:

-Wall doesn't include -Wformat-security

welp

Flat Daddy
Dec 3, 2014

by Nyc_Tattoo
You want the 'Simply Everything Plus' flag.

It gives you Simply Everything... plus format-security

Flat Daddy
Dec 3, 2014

by Nyc_Tattoo
I love memes.

fritz
Jul 26, 2003

compuserved posted:

i'm "all" not meaning all

there's a ton of warnings that aren't in -Wall, i saw an explanation that claimed gcc couldnt add more warnings because of lots of packages out there that have "-Wall -Werror" and more -Wall warnings would break compilation

clang still doesn't have everything useful in -Wall, but it at least adds them over time

Notorious b.s.d.
Jan 25, 2003

by Reene

fritz posted:

there's a ton of warnings that aren't in -Wall, i saw an explanation that claimed gcc couldnt add more warnings because of lots of packages out there that have "-Wall -Werror" and more -Wall warnings would break compilation

clang still doesn't have everything useful in -Wall, but it at least adds them over time

you would think that consumers of "-Wall -Werror" would appreciate having new warnings break the build

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
that is our perspective, yes

although it's a huge pain in the rear end when trying to ship a new compiler internally

Suspicious Dish
Sep 24, 2011

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

Notorious b.s.d. posted:

you would think that consumers of "-Wall -Werror" would appreciate having new warnings break the build

sometimes the warnings are dumb and bogus. there was one gcc added a little while ago in 4.8 which meant nothing and broke every build and was dumb and stupid to fix

qntm
Jun 17, 2009

compuserved posted:

i'm "all" not meaning all

gcc, the php of compilers

VikingofRock
Aug 24, 2008




yeah you definitely want at least -Wall -Wextra (and probably -Wpedantic). Of course none of those contain -Wformat-security. :shrug:

Workaday Wizard
Oct 23, 2009

by Pragmatica

Suspicious Dish posted:

sometimes the warnings are dumb and bogus. there was one gcc added a little while ago in 4.8 which meant nothing and broke every build and was dumb and stupid to fix

i would like to know more

Notorious b.s.d.
Jan 25, 2003

by Reene

Suspicious Dish posted:

sometimes the warnings are dumb and bogus. there was one gcc added a little while ago in 4.8 which meant nothing and broke every build and was dumb and stupid to fix

if you didn't want dumb and bogus warnings, why did you choose -Wall ?

Athas
Aug 6, 2007

fuck that joker
The really dumb thing is using -Werror in production or distribution, precisely for the reason of code being broken by compiler upgrades.

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

Suspicious Dish posted:

warnings are dumb and bogus

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

Athas posted:

The really dumb thing is using -Werror in production or distribution, precisely for the reason of code being broken by compiler upgrades.

i'm the untested compiler upgrades being deployed to production with no way to roll back

suffix
Jul 27, 2013

Wheeee!

Dessert Rose posted:

i'm the untested compiler upgrades being deployed to production with no way to roll back

you don't "roll back", you patch out the dumb -Werror flag, but that's not something your users should have to do just because they use a newer compiler than you

a source distribution that builds with -Werror by default is broken. using it for internal builds and ci is fine.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
using it for CI's dumb too. just have your CI server treat any warnings as a failure while still running tests and stuff

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:
shipping source code to customers :S

VikingofRock
Aug 24, 2008




bobbilljim posted:

shipping source code to customers :S

I know this forum likes to shaggar about "open sores" or whatever but this is not an uncommon thing to do?

Notorious b.s.d.
Jan 25, 2003

by Reene

suffix posted:

you don't "roll back", you patch out the dumb -Werror flag, but that's not something your users should have to do just because they use a newer compiler than you

a source distribution that builds with -Werror by default is broken. using it for internal builds and ci is fine.

"users" should not be compiling anything

VikingofRock
Aug 24, 2008




Notorious b.s.d. posted:

"users" should not be compiling anything

lol if you've never built something from source

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...
there is a marked difference between "here is a compiled library and also our entire toolchain used to build it" and "lol we'll just ship you some .cpp files enjoy"

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...
if you're paying money for it, you better be getting the former

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...
and then, if you change the version of the compiler or anything else in that toolchain, you deserve what you get

Notorious b.s.d.
Jan 25, 2003

by Reene

VikingofRock posted:

lol if you've never built something from source

if you're building something from source, you should have the necessary skills to read your compiler warnings and fix code issues

Cybernetic Vermin
Apr 18, 2005

if you are shipping source the customer shouldn't expect it to be a one-button install sort of thing anyway, most likely you are shipping it because they will build stuff on top of it and will probably do a bunch of stuff to integrate it in their dev setup anyway

-Werror is one of those things especially anal people think have more of an impact and it does either way though. the kind of people who call a meeting to discuss the issue of people not putting enough whitespace in their arithmetic expressions

Shaggar
Apr 26, 2006
one time I sent code to a client but it was developers at the client who were working on integration work w/ our system. I sent them an example of how to consume saml using opensaml and of course they just shoved it right into their system

still, it was kind of cool to see my classes in their stack trace

Cybernetic Vermin
Apr 18, 2005

in the project i work on warnings are rendered useless by a mandatory checkstyle plugin which specifies a million things that no sane person cares about, adding thousands of new "problems" in eclipse every day and drowning out any possibly relevant information in a sea of spergy bullshit

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
yes, let me spend a few hours janitoring code quality issues in the last stable release of this project before i can use it just because i happen to using a compiler with warnings that weren't implemented when it was tagged

Adbot
ADBOT LOVES YOU

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

maybe you should check your compiler binaries into source control if it's causing this much of an issue

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