|
Notorious b.s.d. posted:it's a hack layered on hacks. hacks all the way down much like your posting!!!!!!!!!!
|
# ? Mar 11, 2015 22:58 |
|
|
# ? Jun 13, 2024 04:39 |
|
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
|
# ? Mar 11, 2015 23:17 |
|
b0lt posted:__attribute__(((((((((((((((format(printf,1,2)) 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 |
# ? Mar 11, 2015 23:24 |
|
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>?
|
# ? Mar 11, 2015 23:33 |
|
Suspicious Dish posted:Laugh Or Load Register this is loving brilliant, thank you for sharing this
|
# ? Mar 11, 2015 23:39 |
|
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 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 ...
|
# ? Mar 11, 2015 23:53 |
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
|
|
# ? Mar 12, 2015 02:33 |
|
VikingofRock posted:agreed, no one ever gets bitten by printf errors 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
|
# ? Mar 12, 2015 02:41 |
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
|
|
# ? Mar 12, 2015 02:53 |
|
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
|
# ? Mar 12, 2015 03:12 |
|
pseudorandom name posted:-Wall doesn't include -Wformat-security i'm "all" not meaning all
|
# ? Mar 12, 2015 03:20 |
|
pseudorandom name posted:-Wall doesn't include -Wformat-security welp
|
# ? Mar 12, 2015 03:39 |
|
You want the 'Simply Everything Plus' flag. It gives you Simply Everything... plus format-security
|
# ? Mar 12, 2015 05:41 |
|
I love memes.
|
# ? Mar 12, 2015 05:41 |
|
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
|
# ? Mar 12, 2015 17:23 |
|
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 you would think that consumers of "-Wall -Werror" would appreciate having new warnings break the build
|
# ? Mar 12, 2015 18:05 |
|
that is our perspective, yes although it's a huge pain in the rear end when trying to ship a new compiler internally
|
# ? Mar 12, 2015 18:22 |
|
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
|
# ? Mar 12, 2015 18:26 |
|
compuserved posted:i'm "all" not meaning all gcc, the php of compilers
|
# ? Mar 12, 2015 18:42 |
yeah you definitely want at least -Wall -Wextra (and probably -Wpedantic). Of course none of those contain -Wformat-security.
|
|
# ? Mar 12, 2015 19:15 |
|
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
|
# ? Mar 12, 2015 19:52 |
|
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 ?
|
# ? Mar 12, 2015 20:19 |
|
The really dumb thing is using -Werror in production or distribution, precisely for the reason of code being broken by compiler upgrades.
|
# ? Mar 12, 2015 22:55 |
|
Suspicious Dish posted:warnings are dumb and bogus
|
# ? Mar 12, 2015 23:05 |
|
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
|
# ? Mar 12, 2015 23:08 |
|
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.
|
# ? Mar 13, 2015 01:33 |
|
using it for CI's dumb too. just have your CI server treat any warnings as a failure while still running tests and stuff
|
# ? Mar 13, 2015 03:24 |
|
shipping source code to customers :S
|
# ? Mar 13, 2015 08:07 |
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?
|
|
# ? Mar 13, 2015 17:32 |
|
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 "users" should not be compiling anything
|
# ? Mar 13, 2015 18:03 |
Notorious b.s.d. posted:"users" should not be compiling anything lol if you've never built something from source
|
|
# ? Mar 13, 2015 18:36 |
|
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"
|
# ? Mar 13, 2015 19:04 |
|
if you're paying money for it, you better be getting the former
|
# ? Mar 13, 2015 19:04 |
|
and then, if you change the version of the compiler or anything else in that toolchain, you deserve what you get
|
# ? Mar 13, 2015 19:05 |
|
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
|
# ? Mar 13, 2015 19:28 |
|
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
|
# ? Mar 13, 2015 19:35 |
|
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
|
# ? Mar 13, 2015 19:36 |
|
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
|
# ? Mar 13, 2015 19:37 |
|
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
|
# ? Mar 13, 2015 19:37 |
|
|
# ? Jun 13, 2024 04:39 |
|
maybe you should check your compiler binaries into source control if it's causing this much of an issue
|
# ? Mar 13, 2015 19:38 |