• (nodebb)

    I would have said that the other code block is less wrong rather than more correct, but yes.

  • Sauron (unregistered)

    Mysteriously, today I'm frist.

  • Sole Purpose Of Visit (unregistered)

    Nice Sherlock Homes reference.

  • a cow or something (definitely not a robot) (unregistered)

    Each string gets a "\" appended to the end, which could be a @"" instead. Yes, but without sparing any character... (4 in both cases). Anyway, the fact that "null"!=null could be much better exploited in one of those "obfuscated code contests"...

  • Chris (unregistered)

    I'm going to guess that dir and localDir are never used. Only filePath is used. And at some point later there's a if string.IsNullOrEmpty(filePath) //... logic to set filePath.

  • Prime Mover (unregistered) in reply to Steve_The_Cynic

    More along the lines that the code sample given to us is "not even wrong."

  • d (unregistered)

    The code base I inherited is full of stuff like this. I could submit the entire code base as is and generate content for this site for at least a year.

  • Stella (unregistered)

    When you have eliminated the impossible, whatever remains, however improbable, must be "null".

  • (nodebb)

    We don't know if they use the a recent version of VS, but if they do, there is another layer of WTF - it comes with analyzers out of the box which would flag these variables as unused. OBVIOUSLY, these guys completely ignore those pesky annoyances like "warnings" and "info messages", who cares about those, amirite??

  • (nodebb)

    There is an old adage I continue to use: Debugging is the act of removing errors from a program. Programming is the act of putting them in.

  • MaxiTB (unregistered)

    Why did someone define PRODUCTION when DEBUG is already part of the default project templates since 2001?

  • (nodebb)

    Yeah, somebody's suppressing warnings. Once in a blue moon you actually need to suppress a bogus warning, but almost always it's either an error or can be trivially dealt with by making it clearer to the compiler what you're up to.

    The only case I can think of that needs suppressing is when you have two separate code paths where you're guaranteed one will run but you can't do it as an if...then...else. Assign a default and it gripes that it's never used. Don't assign it, it gripes it's not assigned. (Admittedly, I haven't hit it in years, perhaps they've gotten smarter.)

  • Oliver R (unregistered)

    My guess would be that it works perfectly, because it creates the directory if it doesn't already exist.

  • NotAThingThatHappens (unregistered)

    How is this not flagged for moderation ??

  • Erwin (unregistered)

    My comment with a code snippet (https://thedailywtf.com/articles/comments/constantly-magic): still waiting for moderation months after posting.

    Mag's comment advertising for illegal narcotics: gets published without raising any flags.

    Found the real WTF.

  • MaxiTB (unregistered)

    The real WTF in this thread of comments is that an adertisement can be seen while multiple legit comments are hold for moderation... what is up with that? :)

  • Erwin (unregistered)

    Could we have some daily moderation please?

  • dereferenced null pointer (unregistered)

    EZ: just use the Preprocesser to defile [sic] null to be "null"

  • Erk (unregistered)

    I can tell you how this works... just check the directory "C:\Windows\system32\null" on the machine running this code...

  • Erwin (unregistered)

    A week later and still the highly suspect advertisement is shown and the objections are still hidden while being held for moderation.

    Was it maybe a paid advertisement?

  • Prime Mover (unregistered) in reply to Erwin

    Not illegal everywhere.

Leave a comment on “A Null Mystery”

Log In or post as a guest

Replying to comment #:

« Return to Article