Jump to content

au3 Jokes : how to make easy things complicated


jennico
 Share

Recommended Posts

i found a piece of code from ModerMenuRaw ( by Holger ):

;**********************************************************************
; Get the icon ID like in newer Autoit versions
;**********************************************************************
Func _GetIconID($nID, $sFile)
    If StringRight($sFile, 4) = ".exe"  Then
        If $nID < 0 Then
            $nID = -($nID + 1)
        ElseIf $nID > 0 Then
            $nID = -$nID
        EndIf
    ElseIf StringRight($sFile, 4) = ".icl"  And $nID < 0 Then
        $nID = -($nID + 1)
    Else
        If $nID > 0 Then
            $nID = -$nID
        ElseIf $nID < 0 Then
            $nID = -($nID + 1)
        EndIf
    EndIf
    
    Return $nID
EndFunc   ;==>_GetIconIDoÝ÷ ÛZ·l²î|¬¦¥z»kÊØb±«­¢+ØÀÌØí¥±ôÅÕ½Ðí¡©¨¹±°ÅÕ½Ðì(ÀÌØí¥½¸ô´Ø()5Í ½à À°}Ñ%½¹% ÀÌØí¥½¸°ÀÌØí¥±¤°}Ñ%½¹%È ÀÌØí¥½¸°ÀÌØí¥±¤¤()Õ¹}Ñ%½¹%È ÀÌØí¹%°ÀÌØíÍ¥±¤(%IÑÕɸ´ÀÌØí¹%´ ÀÌØí¹%±ÐìÀ¤)¹Õ¹ìôôÐí}Ñ%½¹%È((쨨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨(ìÐÑ¡¥½¸%±¥­¥¸¹ÝÈÕѽ¥ÐÙÉÍ¥½¹Ì(쨨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨)Õ¹}Ñ%½¹% ÀÌØí¹%°ÀÌØíÍ¥±¤(%%MÑÉ¥¹I¥¡Ð ÀÌØíÍ¥±°Ð¤ôÅÕ½Ðì¹áÅÕ½ÐìQ¡¸($%%ÀÌØí¹%±ÐìÀQ¡¸($$$ÀÌØí¹%ô´ ÀÌØí¹%¬Ä¤($%±Í%ÀÌØí¹%ÐìÀQ¡¸($$$ÀÌØí¹%ô´ÀÌØí¹%($%¹%(%±Í%MÑÉ¥¹I¥¡Ð ÀÌØíÍ¥±°Ð¤ôÅÕ½Ðì¹¥°ÅÕ½Ðì¹ÀÌØí¹%±ÐìÀQ¡¸($$ÀÌØí¹%ô´ ÀÌØí¹%¬Ä¤(%±Í($%%ÀÌØí¹%ÐìÀQ¡¸($$$ÀÌØí¹%ô´ÀÌØí¹%($%±Í%ÀÌØí¹%±ÐìÀQ¡¸($$$ÀÌØí¹%ô´ ÀÌØí¹%¬Ä¤($%¹%(%¹%($(%IÑÕɸÀÌØí¹%)¹Õ¹ìôôÐí}Ñ%½¹%

anyone found similar things ?

:) j.

Edited by jennico
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

Link to comment
Share on other sites

Ehh, funny? No. Code that obviously wasn't optimized? Yes. But we all write unoptimized code. That doesn't make it funny.

All that I see wrong with the code and presumably what the OP finds "funny" is the fact that the function can be re-written to:

Func _GetIconID($nID, $sFile)
    If $nID > 0 Then
        $nID = -$nID
    ElseIf $nID < 0 Then
        $nID = -($nID + 1)
    EndIf
   
    Return $nID
EndFunc ;==>_GetIconID
Obviously much shorter and as far as I can tell functionally equivalent. It can still be further reduced but that just starts adding confusion to a bit of code that's already confusing enough.
Link to comment
Share on other sites

Func _GetIconID2($nID, $sFile)
    Return -$nID - ($nID < 0)
EndFunc ;==>_GetIconID2

maybe you missed out the last abbreviation to the code.

better stay serious and humorless, smiling harms !!!!

the other chat Brett probably means, is:

Chat

General non-AutoIt chat.

j.
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

Func _GetIconID2($nID, $sFile)
     Return -$nID - ($nID < 0)
 EndFunc;==>_GetIconID2

maybe you missed out the last abbreviation to the code.

better stay serious and humorless, smiling harms !!!!

the other chat Brett probably means, is:

j.

You're right, I didn't see it. Now that I do I'll comment: it's bad code. The comparison $nID < 0 returns a boolean value, not a numeric value. We make no guarantee what the value of True and False is numerically. So the original, verbose code is better than yours because it will work correctly and doesn't rely on an unguaranteed boolean to numeric conversion.
Link to comment
Share on other sites

You're right, I didn't see it. Now that I do I'll comment: it's bad code. The comparison $nID < 0 returns a boolean value, not a numeric value. We make no guarantee what the value of True and False is numerically. So the original, verbose code is better than yours because it will work correctly and doesn't rely on an unguaranteed boolean to numeric conversion.

You've just made this thread a whole lot more funny.
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...