- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
typeof((void*)42-0b101010);
Admin
That's a mild WTF in my eyes - It's nothing that a complete rewrite couldn't solve.
Admin
Fixing the root cause is easy. Reach into back pocket, pull out GAU-8, use on the guilty party, job done.
Admin
That's still just a
void*
.Admin
i'm not sure they use "has" prefix in method names consistently
Admin
Oh I am sure every one of these is initialized first. HasCorporateAccount = null anyone? So again we have a yes, no, and filenotfound.
Admin
In fact, it's a compile error because it does pointer arithmetic on a
void *
Admin
A rewrite of the code or a rewrite of the person who wrote it? :)
Admin
See "Reprogramming with a Cluebat: Advanced Edition".
Admin
Admin
I really love when people do this and then complain that $language is inadequate, faulty, insecure, or otherwise less than useable (but there have been some out there where the actual language is TRWTF).
Admin
It should be a compiler error according to both the C and C++ language standards, but GCC and Clang allow it by default in C code as a language extension for compatibility with legacy code (tested with GCC 7.4.0 and Clang 6.0.0). For the purposes of pointer arithmetic on void*, they use an object size of 1 byte, i.e. as if it were char*.
In fact, neither of them so much as issue a warning, even with -Wall -Wextra -std=c99. You need to add -Wpointer-arith (which is included in -pedantic, as well as Clang's -Weverything) to get a warning in C code with GCC or Clang. In C++ mode, both GCC and Clang issue errors, as they should.
Visual Studio 2017 issues an error in both C and C++ mode as well.
Admin
is this really a java wtf? there isn't even a FactoryFactory
Admin
What are these companies that have time for rewrites?