|
Eggplant posted:Some gems from an ASP app that I inherited: code:
|
# ¿ Mar 25, 2008 16:03 |
|
|
# ¿ Apr 29, 2024 05:03 |
|
TRex EaterofCars posted:It's an awesome hack... But come on, it's a hack. Using fallthrough like that is an anti-pattern unless you REALLY need the speed, like Tom Duff did. The performance can actually be terrible as the increment is quite expensive, I found this out with a basic vector add & multiply. Array offsets work better ([n+1], [n+2], ...).
|
# ¿ Mar 29, 2008 05:51 |
|
TRex EaterofCars posted:you're saying that a register increment is expensive? inc reg is probably the cheapest op you can perform aside from the nop. This: code:
code:
MrMoo fucked around with this message at 08:31 on Mar 29, 2008 |
# ¿ Mar 29, 2008 08:27 |
|
Triple Tech posted:
Same crap in PHP, I just roll my eyes and remember 8-bit BASIC. With PHP you have more options to make it read easier, so its even more retarded. Similar vein is variable substitution like this, but for large HTML/XML blocks: code:
|
# ¿ Apr 1, 2008 14:57 |
|
Victor posted:Clearly, return is a function. The SSL library by Reuters has oodles of wonders like this. Basically the API is 20 years old and needs to support every lovely poo poo poo poo compiler and linker out there. To an extreme. It's one function per file as old linkers don't smart link properly.
|
# ¿ Apr 2, 2008 05:54 |
|
pokeyman posted:(Did I miss anything?) Return value seems to be undefined if string has length zero.
|
# ¿ Apr 2, 2008 09:01 |
|
pokeyman posted:It won't simply return the empty string? If it were C that would be a problem, I guess from your comment strings are by default valid and empty. So presumably count would default to 0 too, so no need to set it, however I saw this too: Delphi Basics posted:Strings are indexed with 1 for the first character (arrays start with 0 for the first element). MrMoo fucked around with this message at 11:50 on Apr 2, 2008 |
# ¿ Apr 2, 2008 11:47 |
|
Lexical Unit posted:So we use middleware to pass serialized objects around a network of machines. All code is c++. We have to interface with other people's code over this middleware. Not really middleware then, just a communications system. Most normal message orientated middleware systems use a platform agnostic messaging format, like XDR name, value pairs, or modern behemoths like XML.
|
# ¿ Apr 11, 2008 14:45 |
|
Lexical Unit posted:Hence the horror. I see a float too, float's even though IEEE specified are not standard across platforms. AIX/PowerPC has great issues with this. Technically that middleware is tied to the sending system. TIBCO Rendezvous works across multiple platforms and has an agnostic message format, together with broken IEEE floating points. I'm amazed at the number of clients who expect it to translate even character encoding automagically between hosts. MrMoo fucked around with this message at 16:24 on Apr 11, 2008 |
# ¿ Apr 11, 2008 16:08 |
|
trashmatic posted:Nope. It looks like assembly language for some DSP chip The language looks like the DSP filter assembly language discussed here: http://www.analog.com/library/analogDialogue/archives/31-2/dsp.html
|
# ¿ Apr 16, 2008 05:55 |
|
Someone just pointed out a great structure in my code:code:
code:
|
# ¿ Apr 19, 2008 02:45 |
|
nrichprime posted:I've heard plenty of people describe conditions as being not false. It's true: code:
MrMoo fucked around with this message at 14:59 on May 5, 2008 |
# ¿ May 5, 2008 13:55 |
|
TRex EaterofCars posted:There really should be an &= operator or something for referential equality. Well don't these operators map into the extra math symbols, we have =, ≡, and ≣, so you could have === (≡) as data equality, and ==== (≣) for class equality. I don't have a degree in maths, when would you use "identical to" === (≡) and "strictly equivalent to" ==== (≣)? I just found this for possible usage in OOP: http://weblog.raganwald.com/2008/04/is-strictly-equivalent-to.html MrMoo fucked around with this message at 06:33 on May 16, 2008 |
# ¿ May 16, 2008 06:27 |
|
ashgromnies posted:and most of it is equally unreadable... blargh. It leans more towards retarded than unreadable, quite a few people skip using unless but it's a bit sill considering the post-conditional check.
|
# ¿ Jun 10, 2008 21:50 |
|
mofmog posted:I was bored. On a friday night. Oh god. Oh dear, difficult to be so concise in C: code:
|
# ¿ Jul 12, 2008 13:59 |
|
subreality posted:
|
# ¿ Dec 5, 2008 05:56 |
|
Ryouga Inverse posted:How are you going to deal with the corpus of already-existing code? Re-write it when it fails or needs modification. Probably end up with something neat like MUMPS-Linq.
|
# ¿ Jan 23, 2010 14:29 |
|
Parantumaton posted:There's also two variants of IO API:s in Java, IO and NIO ("New IO"), latter is the faster one in certain situation (there's -if I remember correctly- 16 ways to read in a file in Java at the moment, uhh...). Not enough! Say hello to NIO.2.
|
# ¿ Jan 30, 2010 03:20 |
|
Janin posted:Where I work, none of the builds use -Wall because "it prints too much noise". -Wall -Wextra -Wfloat-equal -Wshadow -Wunsafe-loop-optimizations -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Wnested-externs -Winline -pedantic If you want really noisy output try the ICC compiler, warnings 981 "operands are evaluated in unspecified order" and 2259 "non-pointer conversion from "*" to "*" may lose significant bits" are crazy.
|
# ¿ Feb 8, 2010 04:38 |
|
fritz posted:insure++ warns (warned?) about not saving the return value from printf That's where you end up with all the lazy developers doing inane hacks like void casting returns: code:
|
# ¿ Feb 8, 2010 05:23 |
|
RussianManiac posted:What do you mean? Can you extrapolate? while (0) is used to allow a semicolon after the macro call, it's pretty much the only place it should be used.
|
# ¿ Feb 28, 2010 04:39 |
|
ICC loves to give warnings on C++2003 and C89 errors even though C99 is selected.code:
|
# ¿ Sep 21, 2010 08:35 |
|
Unfortunately no code, but not lacking on humor.quote:searching concurrent linked list; I don't want to make copies of the list. Too expensive. Mom pays for my hardware. http://stackoverflow.com/questions/4178132/searching-concurrent-linked-list
|
# ¿ Nov 14, 2010 17:18 |
|
Janin posted:I'm honestly shocked that Perl runs at all on a EBCDIC platform Perl is there to help convert EBCDIC to more sane encodings. It's surprising how much Perl is used on big expensive machines.
|
# ¿ Dec 15, 2010 04:03 |
|
Randomly sticking in volatile modifiers for a single threaded piece of code with no external IO, nice. I think Drepper would have a nice chuckle.
|
# ¿ Jan 5, 2011 03:44 |
|
pseudorandom name posted:Slapping a volatile on those variables forces them to be stored to memory, which truncates the 80 bit x87 FPU representation down to 64-bits, Or rather any operation on the volatile double causes the x87 register to be copied to a x86 register causing the down conversion, without the volatile the intermediate values can be kept in the x87?
|
# ¿ Jan 5, 2011 04:59 |
|
pseudorandom name posted:Nope, volatile requires memory, not integer registers. But it isn't forcing software x87 emulation, so its copy from x87 registers to main memory and back to x87 registers for each op?
|
# ¿ Jan 5, 2011 07:51 |
|
Edison was a dick posted:I don't understand your point. ANSI C is not C99 and while C99 is becoming the standard, ANSI C is portable to compilers that don't support C99, so if you program for portability it is beneficial to pick the standard with the most compiler support. C99 is ANSI C, along with C90 and C89. What am I missing? http://en.wikipedia.org/wiki/ANSI_C Similar pedant post of the day on Stackoverflow, "UTF-8 isn't guaranteed by the C++ standard so you shouldn't use it": http://stackoverflow.com/questions/4766301/windows-console-and-qt-unicode-text/4769080#4769080 I deliberately use UTF-8 to gently caress over stupid MSVC users, I have no problem in MSVC 2010, OS X, Solaris or Red Hat. Just because Windows likes UCS2-LE internally doesn't mean you have to use it anywhere else. MrMoo fucked around with this message at 15:08 on Jan 24, 2011 |
# ¿ Jan 24, 2011 15:02 |
|
Well I wouldn't jump to thinking C89 either.
|
# ¿ Jan 25, 2011 17:34 |
|
I like that, "Obviously".
|
# ¿ Mar 12, 2011 12:04 |
|
Thankfully inline assembler is no longer supported with Win64.
|
# ¿ Mar 25, 2011 05:04 |
|
nielsm posted:MSVC for 64 bit doesn't allow inline assembly. You can still have assembly source files and call functions written entirely in assembly. Yup. I have some assembler for ticket based spinlocks that requires 8-bit and 16-bit atomic ops, but Win API only provides one 32-bit aligned 16-bit atomic op and everything else is 32-bit or 64-bit. The limiting factor seems support of IA64 which does not permit such short aligned operations. I tried using external MASM64 only to find that the supported syntax can be very different to MASM, i.e. MASM64 is like a version 1.0 and MASM32 is a version 8.0 with a lot more features. If you trawl the MSDN forums you can find tidbits from the developers. I ended up bumping the locks up to 32-bit and 64-bit ops for Win64 as the intrinsic operations end up faster than function calls.
|
# ¿ Mar 28, 2011 04:36 |
|
SavageMessiah posted:http://www.infoq.com/presentations/Development-at-Google Isn't Apache similar? I seem to recall massive numbers browsing one project. HTTPD is at 1134699, http://svn.apache.org/repos/asf/httpd/
|
# ¿ Jun 11, 2011 18:32 |
|
shrughes posted:That's still terrible, the code is hard to read with the type name so far from the variable. lol, it's when you have to add restrict it gets even more entertaining. code:
|
# ¿ Jul 31, 2011 11:57 |
|
Not lined up hints at different tab size, if it was stackoverflow, inane disinterest in effort is quite popular.
|
# ¿ Aug 5, 2011 06:41 |
|
TasteMyHouse posted:I was mostly upset about (condition)?true:false; You end up with a lot of code like that when writing 64-bit code and getting it to work on 32-bit platforms. A 64-bit non-zero integer evaluates as false on IA32 due to automagic promotion to a 32-bit integer.
|
# ¿ Sep 8, 2011 05:43 |
|
Internet Janitor posted:-Use a programming language meant for data processing. R, for example, can easily deal with millions of rows of data in a fraction the time and space Excel would require. There are a few solutions that provide an Excel like interface around large scale data processing. FORA springs to mind: http://broadstreetanalytics.com/spreadsheet.html Thomson Reuters have one too but I don't know much about it's integration potential currently. I'm starting a new job on Monday which I think is about doing this, so
|
# ¿ Oct 29, 2011 17:18 |
|
I've just been picking up a couple of new APIs at work (Thomson Reuters) and it's utterly depressing. C++ code written by poor C developers that skip all the basics, code copy and pasted from many other projects and not even bothering to change introduction text or pre-processor guards. Today I'm looking at C code that is conversely written by poor C++ Windows developers showing no basic understanding of C coding and loving up everything. Who the gently caress puts static prototypes in public headers? Unfortunately this isn't them: http://stackoverflow.com/questions/7912863/is-there-a-way-to-have-static-prototypes-and-public-ones-in-the-same-header-file Apparently the C++ API is cleaned up a bit, they were previously adding "using namespace" inside public headers. The private headers in each example still does it though, and the C APIs certainly don't care about polluting namespace everywhere. What gets me is a "lean high performance" API has examples comprising 20 headers and 20 C++ files for sending demo values and performing absolutely zero processing on the content. Comedy note that a new "ultra performance" API uses select on Windows and this is an API designed and built on Windows and then ported to Solaris and Linux taking really crufty Windows API clones for i18n, configuration files and other services.
|
# ¿ Nov 30, 2011 04:17 |
|
Using Java to integrate between PHP and COBOL, fricking awesome.
|
# ¿ Jan 26, 2012 04:53 |
|
|
# ¿ Apr 29, 2024 05:03 |
|
I thought they would have gone with Vala if anything. Good to know alternative languages are always being investigated though.
|
# ¿ Jan 28, 2012 12:28 |