|
You're not allowed to redefine keywords at all if you use the standard library. I don't think the standard bothers to specify what happens if you don't use the standard library, which makes it implicitly UB.
|
# ? Dec 11, 2013 02:00 |
|
|
# ? Jun 5, 2024 07:21 |
|
You certainly could make some types become standard-layout types when they weren't before.
|
# ? Dec 11, 2013 02:11 |
|
code:
|
# ? Dec 11, 2013 02:38 |
|
I don't believe you.
|
# ? Dec 11, 2013 02:47 |
|
shrughes posted:Recently, I saw this... I've seen that along with #define const in a PCH before.
|
# ? Dec 11, 2013 03:08 |
|
Of course, the actual horror there is unit testing private methods.
|
# ? Dec 11, 2013 04:13 |
|
Ithaqua posted:Of course, the actual horror there is unit testing private methods. Unless you're teaching a programming class, and want some automated testing. I don't understand the need for the extra #undef private, am I missing something?
|
# ? Dec 11, 2013 07:17 |
|
Voted Worst Mom posted:Unless you're teaching a programming class, and want some automated testing. I don't understand the need for the extra #undef private, am I missing something? It's to keep the scope of the change as limited as possible (out of other headers). But it doesn't matter because it's still wrong, because it could very well cause binary incompatibility between different .cc files.
|
# ? Dec 11, 2013 07:28 |
|
The correct way is:C++ code:
The actual correct way is breaking your units down more so the private parts* are objects with public methods you can test. * No sniggering at the back
|
# ? Dec 11, 2013 14:45 |
|
If refactoring your code to not be terrible is too much work, friend classes are a far less bad way to expose your privates to the tests than preprocessor trickery.
|
# ? Dec 11, 2013 16:46 |
|
Ran across this in the kernel today (Freescale):code:
|
# ? Dec 11, 2013 18:50 |
|
I was looking at the Oregon healthcare exchange website, specifically the way you sign up. It's IE-only, you only have one hour to complete the application, and you can't save. Also, "the Adobe Acrobat PDF plug-in is required to submit this application." https://apps.state.or.us/mbs/landing.jspx I'm sure at least some of the insanity comes from the way the state wanted to handle the applications coming in, but god drat. Designed and developed in just the past couple years >:[
|
# ? Dec 12, 2013 04:00 |
|
IE only is probably just begging for some sort of accessibility lawsuit somewhere down the line. It is also kind of shocking given that msie is no longer the clear leader in market share.
|
# ? Dec 12, 2013 04:17 |
|
It's probably less shocking if you're aware it's another fine Oracle product.
|
# ? Dec 12, 2013 05:30 |
|
I am stunned to see a "submittable" PDF document in TYOOL 2013. I've seen plenty of "fill-and-print" forms, but I haven't encountered the fully submittable kind since filling out college applications back in the '90s.
|
# ? Dec 12, 2013 06:19 |
|
Empty catch blocks are a bad practice, right?C# code:
|
# ? Dec 12, 2013 08:17 |
|
I made a thing. iOS developers will probably empathize. An excerpt:Objective-C code:
hackbunny fucked around with this message at 11:52 on Dec 12, 2013 |
# ? Dec 12, 2013 10:12 |
|
Why are you not using ARC?!?!
|
# ? Dec 12, 2013 10:22 |
|
A hipstery love of the warm analog smoothness of manual memory management? It sure beats COM, I would have killed for autorelease pools back then Huge legacy codebase, plus I've only been an iOS developer since April
|
# ? Dec 12, 2013 10:43 |
|
Xcode's automatic converter works quite well. I was able to convert a ~20 kloc codebase to ARC in well under a day with it (although it'd be harder if the code does anything that can't be represented by ARC, naturally).
|
# ? Dec 12, 2013 15:13 |
|
Used the auto convert on some pretty large projects, if it comes across some code where that tool fails, it will alert you. Even more better, you can just flag that file as being non ARC and have it live side by side ARC code.
|
# ? Dec 12, 2013 15:21 |
|
redleader posted:Empty catch blocks are a bad practice, right? Most likely yes. At a minimum you probably should be logging the Exception even if you are swallowing it. I would also catch a more specific Exception so when you get an OutOfMemoryException it's does crash your application instead of allowing the application to live a little longer. If the code in the TRY block is throwing exception to alert you of information then change the code (if you can) to not throw an Exception unless something exceptional occurs.
|
# ? Dec 12, 2013 15:48 |
|
gariig posted:I would also catch a more specific Exception so when you get an OutOfMemoryException it's does crash your application instead of allowing the application to live a little longer. There is no such thing as OutOfMemoryException. OutOfMemoryError is not a subclass of Exception and isn't covered by that catch block.
|
# ? Dec 12, 2013 15:54 |
|
Lysidas posted:There is no such thing as OutOfMemoryException. OutOfMemoryError is not a subclass of Exception and isn't covered by that catch block. You are speaking Java but redleader posted it as a C# code example. In .NET land OutOfMemoryException is derived from Exception so OutOfMemoryException would be caught and swallowed. It still stands that most of the time you should not be swallowing the Exception class but I've done it in smaller utility applications. For Production code you really shouldn't be doing that.
|
# ? Dec 12, 2013 15:59 |
|
Ah, that makes sense. I apparently missed the "C#" at the top of the code block and the capitalized ToString. That's a strange exception hierarchy, though.
|
# ? Dec 12, 2013 16:05 |
|
Pokemon exception handling is never good.
|
# ? Dec 12, 2013 16:19 |
|
Ithaqua posted:Pokemon exception handling is never good. For a while now I've been playing with the idea to make an app based around Pokemon exceptions. Give the user the tools to cause exceptions and track which ones they already caused. Maybe make it possible to trade them even, I don't know. Maybe on a rainy weekend...
|
# ? Dec 12, 2013 16:23 |
|
I'm not sure whether or not this is a horror or a beautiful masterpiece: https://github.com/bradfitz/goimports/pull/26#issuecomment-30389623 quote:I don't know if this will go in my favor or against, but I happen to have a lot of small Go packages that are kept in a folder starting with a number.
|
# ? Dec 12, 2013 17:15 |
|
Ithaqua posted:Pokemon exception handling is never good. I have an error logging application that practices Pokemon handling.
|
# ? Dec 12, 2013 17:17 |
|
Glimm posted:I'm not sure whether or not this is a horror or a beautiful masterpiece:
|
# ? Dec 12, 2013 17:49 |
|
I've heard that sentiment from a lot of coders but I really don't understand it. I don't think I've ever taken longer than about 10 seconds to come up with an appropriate name for a variable, function, object or project. Are these guys using some wappy, super-abstract programming techniques or something?
|
# ? Dec 12, 2013 17:59 |
|
..btt posted:Are these guys using some wappy, super-abstract programming techniques or something? Yea, autism.
|
# ? Dec 12, 2013 18:01 |
|
Lysidas posted:That's a strange exception hierarchy, though. SomeException is-a Exception. Yeah, really weird.
|
# ? Dec 12, 2013 18:24 |
|
hackbunny posted:UITableView is a glitchy piece of gross poo poo I changed the cell layout and now it crashes again in [self.eventList endUpdates] I give up, I'll just use reloadData e: annnd it's glitchy as gently caress. I'm this close to just using a second UITableView and swapping between the two hackbunny fucked around with this message at 18:41 on Dec 12, 2013 |
# ? Dec 12, 2013 18:38 |
|
Trying to do some stuff with the Google Drive API. First of all, the v2 of their API got moved to NuGet but doesn't have all the required prereqs and then it looks like there's conflicts so I can't even get that to work, so I get like, a v0 release (seriously all of this is horribly documented, too) So then, You'd think getting values from a spreadsheet would be like connect to google get the doc by name doc.sheets[0].content[0][0] and there you've got your first cell But it's this ungodly mess here just to read cells: code:
Why couldn't it just be loving simple e: I guess it's not really a horror; I just wanted to complain Sockser fucked around with this message at 18:49 on Dec 12, 2013 |
# ? Dec 12, 2013 18:46 |
|
..btt posted:I've heard that sentiment from a lot of coders but I really don't understand it. I don't think I've ever taken longer than about 10 seconds to come up with an appropriate name for a variable, function, object or project. Are these guys using some wappy, super-abstract programming techniques or something? I've expressed that sentiment and I also don't think I've ever taken longer than 10 seconds to come up with an appropriate name. 10 seconds is a long time.
|
# ? Dec 12, 2013 19:10 |
|
Sockser posted:Trying to do some stuff with the Google Drive API. It is rather telling that I couldn't find any Google things that actually use the public API.
|
# ? Dec 12, 2013 19:14 |
|
Even a crap name shouldn't be a major issue with proper tooling. Oh no, i've mislabeled a variable. This will take multiple keystrokes to unwind.
|
# ? Dec 12, 2013 19:14 |
|
Naming/renaming local variables is easy, but interfaces & classes that are part of your public API can be both difficult to name clearly, and nearly impossible to change. It's particularly troublesome when you might have many implementations of something.
|
# ? Dec 12, 2013 19:43 |
|
|
# ? Jun 5, 2024 07:21 |
|
Yep, so let's go with 1899342
|
# ? Dec 12, 2013 20:02 |