selfmade ([personal profile] selfmade) wrote2007-06-28 02:49 pm

WTF code

What the fuck ?!!

protected bool _IsDate (string strDate)
{
    try
    {
        // Trap for the / in a date string. Reuters sends it that way
        int intTrapped = 0;
        string _strSeparator = "/";
        intTrapped = strDate.IndexOf(_strSeparator);

        if (intTrapped <=0)
        {
            return false;
        }

        return true;
    }
    catch
    {
        return false;
    }
}

Это у нас на работе такой код.

[identity profile] zauberer.livejournal.com 2007-06-28 09:13 pm (UTC)(link)
По-моему, на bash.org.ru недавно было что-то вроде:

if (a == TRUE) {
   some action
} else {
   // на всякий случай
   if (a<>FALSE) throw exception;
   another action
}

И подпись: "Какой ещё нафиг всякий случай?!"

[identity profile] selfmade.livejournal.com 2007-06-29 01:50 am (UTC)(link)
Да вот такой - http://msdn2.microsoft.com/en-us/library/system.data.oracleclient.oracleboolean(VS.80).aspx

where a standard Boolean has two possible values, true and false, an OracleBoolean structure has three possible values, True, False, or Null.

[identity profile] juan-gandhi.livejournal.com 2007-06-29 03:44 am (UTC)(link)
А, знаю, знаю. А напишешь в одну строчку, скажут - многа букав.