You know, it's so difficult to use an integer as an index on an array, we should just throw an eval around it instead.code:
|
|
# ? Jul 1, 2008 20:18 |
|
|
# ? Apr 27, 2024 12:49 |
|
shopvac4christ posted:You know, it's so difficult to use an integer as an index on an array, we should just throw an eval around it instead. If that wasn't autogenerated, there is no God.
|
# ? Jul 1, 2008 21:36 |
1337JiveTurkey posted:If that wasn't autogenerated, there is no God. Well, prepare to have nowhere to go when you die.
|
|
# ? Jul 1, 2008 22:29 |
|
shopvac4christ posted:Well, prepare to have nowhere to go when you die. I remember playing in mIRC scripting. There are no arrays in this language (or weren't, yet). So if I wanted to have, say, an array of players, my best method was $[player. [ $+ [ $num ] ] ] Things got worse before they had hashes. If I wanted to load a player's stats into a location... $[player. [ $+ [ $num ] $+ ] .attack] I wrote an entire game in this "language". (I'll try to pull out some examples when I get home.)
|
# ? Jul 1, 2008 22:49 |
|
shopvac4christ posted:You know, it's so difficult to use an integer as an index on an array, we should just throw an eval around it instead. At least there's a variable involved. I recently had the joy of working with code full of this: code:
|
# ? Jul 2, 2008 00:36 |
|
Here is one from my work:code:
1. TransactionControlNumber stored as a string. 2. Uses a while loop to pad the number.
|
# ? Jul 2, 2008 14:44 |
|
I started working on a new project yesterday so I was reading some of the code trying to get a feel for how things are organized. I noticed two files called DirectoryFileObjects.h and two files called DirectoryFileObjects.cc. I diffed each pair to see what was up, they were the same. So I went into the revision tool and what I see is that one of them is an original and the other is just a copy that is kept in sync with changes made to the original. Like, the revision comments on one of the pair of files is something like: - added blah support And then the revision comments on the other file (for the same change) is: - synced with master Why? Because the developer needed some of the functions defined in DirectoryFileObjects.h, but he needed them somewhere else than where the original DirectoryFileObjects.h exists. And that's not mentioning the 2345 line function in DirectoryFileObjects.cc whose last 14 lines are nothing but closing braces stepping down 14 levels of indentation.
|
# ? Jul 2, 2008 15:10 |
|
My housemate does horrible things with variable names. His code often looks like thiscode:
|
# ? Jul 3, 2008 19:30 |
|
Teabiscuit posted:My housemate does horrible things with variable names. His code often looks like this This is hilarious.
|
# ? Jul 3, 2008 19:57 |
|
Teabiscuit posted:My housemate does horrible things with variable names. His code often looks like this Dotfuscator should work like this.
|
# ? Jul 3, 2008 21:11 |
|
ryanmfw posted:Minus the social part, yeah. I didn't go to them to meet people. It was a lot more fun crushing their hopes and dreams.... Demented and sad, but social.
|
# ? Jul 3, 2008 21:37 |
Teabiscuit posted:My housemate does horrible things with variable names. His code often looks like this Buy him an account here. Username: SHITCOCK++
|
|
# ? Jul 4, 2008 00:17 |
|
rotor posted:Demented and sad, but social. Oh please, they all played WoW, so they thought they were good at computers with the associated egos. The one team gave up 30 minutes into it to play some flash version of DDR.
|
# ? Jul 4, 2008 04:50 |
|
It's from The Breakfast Club. Don't you forget about that film.
|
# ? Jul 4, 2008 10:09 |
|
Smackbilly posted:Agreed. We don't need a full whacko APL keyboard, but it would be pretty nice to at least have characters for basic set operations (intersect, union, subset, superset), and a single glyph for -> on normal keyboards. I'd even be happy with settling for a bigraph for subset-or-equal and superset-or-equal.
|
# ? Jul 4, 2008 14:46 |
|
PrBacterio posted:I'm also one of those people who'd prefer the Pascal-style syntax of = as the comparison operator with := being used for assignments, instead of the C-style == for a comparison operator...) = is for unification (Which is a mixture of non-destructive asignment and equality, X=3 succeeds if X is unbound (so, x is set to 3) or X is already set to 3. )
|
# ? Jul 4, 2008 15:41 |
|
PrBacterio posted:Well I don't necessarily know about those, but I would very much welcome being able to use the proper glyphs, i.e. ≠, ≤ and ≥, for comparisons, instead of !=, <= and >=. Sounds like you'd like Applescript! quote:(I'm also one of those people who'd prefer the Pascal-style syntax of = as the comparison operator with := being used for assignments, instead of the C-style == for a comparison operator...) The one true assignment operator is ← code:
|
# ? Jul 4, 2008 23:54 |
Flobbster posted:In my ideal world, ← would be for assignment, = for equality (overloadable), and ≡ for identity (point to the same object/address in memory). If those were easily typable, I'd support your endeavor whole heartedly. \/\/ Not working. Jo fucked around with this message at 02:26 on Jul 7, 2008 |
|
# ? Jul 5, 2008 05:38 |
|
Jo posted:If those were easily typable, I'd support your endeavor whole heartedly. What, you have a problem typing alt+27 every time you want to assign to a variable?
|
# ? Jul 5, 2008 09:10 |
|
Jo posted:If those were easily typable, I'd support your endeavor whole heartedly.
|
# ? Jul 5, 2008 12:23 |
|
But assignment is way more common than testing equality, so it deserves the shorter operator!
|
# ? Jul 5, 2008 12:47 |
|
Flobbster posted:Sounds like you'd like Applescript!
|
# ? Jul 5, 2008 22:33 |
|
Vanadium posted:But assignment is way more common than testing equality, so it deserves the shorter operator! Also it has the same length as <=, >= and != which appeals to the symmetry-loving.
|
# ? Jul 8, 2008 14:35 |
|
I remember catching this one time in production C# code at an old job:code:
|
# ? Jul 8, 2008 19:34 |
|
zootm posted:I remember catching this one time in production C# code at an old job: Actually, I'm guilty of doing this sometimes, but I always remove it afterwards. (hell, I even use the exact same "int i = 0"!) Is there a more correct way?
|
# ? Jul 8, 2008 21:49 |
|
In C# you can use System.Diagnostics.Debugger.Break(). C/C++ often have platform-specific ways of triggering a debug break point, and on PCs there's always interrupt 3. I'm not sure about other languages but they often have their own ways of breaking into the debugger
|
# ? Jul 8, 2008 21:52 |
|
In most Java debuggers, and I suspect in VS by now, you can set the system to break on exception. In any case I imagine putting at least a throw; in there would be preferable for when you forget to remove the code, so the semantics don't change.
|
# ? Jul 8, 2008 22:01 |
|
Can't you just put the breakpoint on the closing brace?
|
# ? Jul 8, 2008 22:13 |
|
zootm posted:In most Java debuggers, and I suspect in VS by now, you can set the system to break on exception. In any case I imagine putting at least a throw; in there would be preferable for when you forget to remove the code, so the semantics don't change.
|
# ? Jul 8, 2008 22:20 |
|
Unless a throw was omitted from the catch{} statement above, then adding the catch{} changes the semantics to the exception being handled. Not good!
|
# ? Jul 8, 2008 22:29 |
|
RoadCrewWorker posted:Still, how would declaring a block variable that gets lost after the catch{} is done change the semantics of the program? It really is best to avoid munging your program at all to make it "easier to debug"; this sort of thing can be too easy to leave in to a stage where it's more expensive to find and fix. Volte posted:Can't you just put the breakpoint on the closing brace?
|
# ? Jul 8, 2008 22:55 |
|
ehnus posted:In C# you can use System.Diagnostics.Debugger.Break(). C/C++ often have platform-specific ways of triggering a debug break point, and on PCs there's always interrupt 3. I'm not sure about other languages but they often have their own ways of breaking into the debugger quote:I suspect in VS by now, you can set the system to break on exception. OneEightHundred fucked around with this message at 23:15 on Jul 8, 2008 |
# ? Jul 8, 2008 23:04 |
|
zootm posted:In most languages you can't breakpoint on a line that isn't executed; braces are just syntax.
|
# ? Jul 8, 2008 23:14 |
|
OneEightHundred posted:I'm still trying to find this. Edit: I lie, Google apparently knows about these things. See under Breaking on Exceptions on this page. Volte posted:Well it works in Eclipse with MinGW/GDB. zootm fucked around with this message at 23:21 on Jul 8, 2008 |
# ? Jul 8, 2008 23:19 |
|
zootm posted:I've no idea, I'm afraid I don't use Windows so finding it is kinda impossible for me. $10 completely fake dollars says it doesn't work with GCC and -O3. As ehnus said, there's always int 3 (which can also be triggered with *(int*)13 = 3; Coincidentally, *(int*)13 = 3 is a pretty good way of causing a breakpoint (not always a recoverable one) on any platform
|
# ? Jul 9, 2008 02:41 |
|
more falafel please posted:$10 completely fake dollars says it doesn't work with GCC and -O3. What doesn't, breaking on exception? Works fine. Why is everyone so astounded by this?
|
# ? Jul 9, 2008 03:05 |
|
zootm posted:In most languages you can't breakpoint on a line that isn't executed; braces are just syntax.
|
# ? Jul 9, 2008 10:01 |
|
more falafel please posted:$10 completely fake dollars says it doesn't work with GCC and -O3. Uh, wouldn't *(int*)13 = 3 cause a general protection fault (and possibly a bus error on archs that require aligned memory access), because you're trying to write the value 0x00000003 into memory at location 0x000000D ? I don't see how this has anything to do with interrupt 3.
|
# ? Jul 9, 2008 12:18 |
|
CeciPipePasPipe posted:Uh, wouldn't *(int*)13 = 3 cause a general protection fault (and possibly a bus error on archs that require aligned memory access), because you're trying to write the value 0x00000003 into memory at location 0x000000D ? I don't see how this has anything to do with interrupt 3. The only disadvantage is that you normally can't hit F5 and continue execution after hitting the latter, as you can with the former. Personally, I use a 'DEBUG_BREAK()' macro which is defined on a per-platform basis.
|
# ? Jul 9, 2008 12:30 |
|
|
# ? Apr 27, 2024 12:49 |
|
TSDK posted:Interrupt 3 is a break to debugger. Causing a general protection fault will also stop execution and drop you to the debugger in most cases. Oh ok, wouldn't it be easier to just do "int breakme=1/0;" or something then?
|
# ? Jul 9, 2008 12:33 |