The Daily WTF
-
Welchen Sinn macht denn solch eine Funktion?
Ich übergebe den Besitz "vielleicht"?
Wenn nur der nackte Pointer gebraucht wird, warum dann die Schnittstelle vom auto_ptr abhängig machen?
Vor allem, wenn das hier völlig gültiger Code ist:void foo( auto_ptr<X>* ptr) { auto_ptr<X> harry = *ptr; }
Entweder ich übergebe den Besitz oder nicht - nix dazwischen. Nix auto_ptr per Referenz oder Pointer -.-'
-
naja, wenn der programmierer selber hauptsächlich mit auto_ptr arbeitet(weil er von shared_ptr nix gehört hat), und in der funktion selber den zeiger nur benutzen will, ohne dann immer ein lästiges bar.get() zu schreiben, dann versteh ich das.
-
Wenn man eigentlich boost::scoped_ptr meint, dann aber trotzdem std::auto_ptr nimmt macht die Übergabe per Referenz z.B. Sinn.
-
enum Bool { True, False, FileNotFound };
-
sort(gvProjekt.begin(), gvProjekt.end()); if (!bAufsteigend) reverse(gvProjekt.begin(), gvProjekt.end());
-
-
Nicht schlecht, wir könnten hier bei c++.de eine Headersammlung erstellen, so daß man sich hier alle existierenden Header in einer einzigen Zip laden kann.
-
Marc++us schrieb:
Nicht schlecht, wir könnten hier bei c++.de eine Headersammlung erstellen, so daß man sich hier alle existierenden Header in einer einzigen Zip laden kann.
Na, für die Humor-Seite wär' das doch was.
Dann aber bitte auch 'nen FAQ Beitrag.
-
<xsl:template name="Replace"> <xsl:param name="string" select="''"/> <xsl:param name="pattern" select="''"/> <xsl:param name="replacement" select="''"/> <xsl:choose> <xsl:when test="$pattern!='' and $string!='' and contains($string, $pattern)"> <xsl:value-of select="substring-before($string, $pattern)"/> <xsl:copy-of select="$replacement"/> <xsl:call-template name="Replace"> <xsl:with-param name="string" select="substring-after($string, $pattern)"/> <xsl:with-param name="pattern" select="$pattern"/> <xsl:with-param name="replacement" select="$replacement"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$string"/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="ReplaceLCWithHTML"> <xsl:param name="input" select="''"/> <xsl:choose> <xsl:when test="$input!=''"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string" select="$input"/> <xsl:with-param name="pattern" select="'à'"/> <xsl:with-param name="replacement" select="'à'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'á"/> <xsl:with-param name="replacement" select="'á'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'â'"/> <xsl:with-param name="replacement" select="'â'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'è'"/> <xsl:with-param name="replacement" select="'è'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'é'"/> <xsl:with-param name="replacement" select="'é'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'ê'"/> <xsl:with-param name="replacement" select="'ê'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'ì'"/> <xsl:with-param name="replacement" select="'ì'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'í'"/> <xsl:with-param name="replacement" select="'í'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'î'"/> <xsl:with-param name="replacement" select="'î'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'ò'"/> <xsl:with-param name="replacement" select="'ò'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'ó'"/> <xsl:with-param name="replacement" select="'ó'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'ô'"/> <xsl:with-param name="replacement" select="'ô'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'ù'"/> <xsl:with-param name="replacement" select="'ù'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'ú'"/> <xsl:with-param name="replacement" select="'ú'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'û'"/> <xsl:with-param name="replacement" select="'û'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'ý'"/> <xsl:with-param name="replacement" select="'ý'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'œ'"/> <xsl:with-param name="replacement" select="'œ'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'ç'"/> <xsl:with-param name="replacement" select="'ç'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'™'"/> <xsl:with-param name="replacement" select="'™'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'¢'"/> <xsl:with-param name="replacement" select="'¢'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'©'"/> <xsl:with-param name="replacement" select="'©'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'®'"/> <xsl:with-param name="replacement" select="'®'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'°'"/> <xsl:with-param name="replacement" select="'°'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="' '"/> <xsl:with-param name="replacement" select="' '"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'­'"/> <xsl:with-param name="replacement" select="' '"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'·'"/> <xsl:with-param name="replacement" select="'·'"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$input"/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="ReplaceUCWithHTML"> <xsl:param name="input" select="''"/> <xsl:choose> <xsl:when test="$input!=''"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string"> <xsl:call-template name="Replace"> <xsl:with-param name="string" select="$input"/> <xsl:with-param name="pattern" select="'À'"/> <xsl:with-param name="replacement" select="'À'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'Á'"/> <xsl:with-param name="replacement" select="'Á'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'Â'"/> <xsl:with-param name="replacement" select="'Â'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'È'"/> <xsl:with-param name="replacement" select="'È'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'É'"/> <xsl:with-param name="replacement" select="'É'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'Ê'"/> <xsl:with-param name="replacement" select="'Ê'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'Ì'"/> <xsl:with-param name="replacement" select="'Ì'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'Í'"/> <xsl:with-param name="replacement" select="'Í'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'Î'"/> <xsl:with-param name="replacement" select="'Î'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'Ò'"/> <xsl:with-param name="replacement" select="'Ò'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'Ó'"/> <xsl:with-param name="replacement" select="'Ó'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'Ô'"/> <xsl:with-param name="replacement" select="'Ô'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'Ù'"/> <xsl:with-param name="replacement" select="'Ù'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'Ú'"/> <xsl:with-param name="replacement" select="'Ú'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'Û'"/> <xsl:with-param name="replacement" select="'Û'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'Ý'"/> <xsl:with-param name="replacement" select="'Ý'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'Œ'"/> <xsl:with-param name="replacement" select="'Œ'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'Ç'"/> <xsl:with-param name="replacement" select="'Ç'"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'&NBSP;'"/> <xsl:with-param name="replacement" select="' '"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="pattern" select="'&SHY;'"/> <xsl:with-param name="replacement" select="' '"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$input"/> </xsl:otherwise> </xsl:choose> </xsl:template>
-
*IIIHH* jetzt hab ich wegen dir Augenkrebs
-
void printf_to_string( int first, char * fomat, ... ) { va_list marker; va_start( marker, first ); // this is required, or it will not work for some reason *(char*)*va_arg( marker, char * ); // string to write to // ** MUST BE FIRST AFTER FORMAT IN FUNCTION COMAND LINE ** {} /* make the variable */ char * string_write_to = va_arg( marker, char * ); char temporary_file_name[ 19 ]; char * temorary_file_name_name ; strcpy( temporary_file_name, "thefileXXXX" ); temorary_file_name_name = _mktemp( temporary_file_name ); {} FILE * FILE1 = fopen( temporary_file_name, "w" ); vfprintf( FILE1, fomat, marker ); fclose( FILE1 ); {} FILE * FILE11 = fopen( temporary_file_name, "r" ); {} // 2 is to the end ... it took some experamenting // -1 is so we go back and dont get the blank after it fseek( FILE11, -1, 2 ); {} double bignumberjustincase = ftell( FILE11 ); fclose( FILE1 ); FILE * FILE111 = fopen( temporary_file_name, "r" ); read( _fileno( FILE111 ), string_write_to, (short)bignumberjustincase ); int stopHere = (long)string_write_to + (int)0; stopHere = stopHere + (bignumberjustincase); if ( stopHere != 0 ) { ((char*)stopHere)[ 0 ] = '\0'; strcpy( string_write_to + int(bignumberjustincase ), "" ); va_end( marker ); } }
-
Das erklärt dann auch das Performanceproblem der zugehörigen Applikation.
-
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long) Private Const MOUSEEVENTF_ABSOLUTE = &H8000 ' absolute move Private Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up Private Const MOUSEEVENTF_MOVE = &H1 ' mouse move Private Const MOUSEEVENTF_MIDDLEDOWN = &H20 Private Const MOUSEEVENTF_MIDDLEUP = &H40 Private Const MOUSEEVENTF_RIGHTDOWN = &H8 Private Const MOUSEEVENTF_RIGHTUP = &H10 Private Sub Register(OCXName As String) SetCursorPos 32, Screen.Height / 15 - 10 mouse_event MOUSEEVENTF_ABSOLUTE, 32, Screen.Height / 15 - 10, 1, 1 mouse_event MOUSEEVENTF_LEFTDOWN, 32, Screen.Height / 15 - 10, 1, 1 mouse_event MOUSEEVENTF_LEFTUP, 32, Screen.Height / 15 - 10, 1, 1 SendKeys ("R") SendKeys ("regsvr32 " & OCXName) SendKeys (vbKeyReturn) End Sub
-
for(int i=1;i<=EdtEingabe->Text.Length();i++) { switch(EdtEingabe->Text[i]) { //Buchstaben A-Z case 'A':K L Sleep(y); break; case 'B':L K K K Sleep(y); break; case 'C':L K L K Sleep(y); break; case 'D':L K K Sleep(y); break; case 'E':K Sleep(y); break; case 'F':K K L K Sleep(y); break; case 'G':L L K Sleep(y); break; case 'H':K K K K Sleep(y); break; case 'I':K K Sleep(y); break; case 'J':K L L L Sleep(y); break; case 'K':L K L Sleep(y); break; case 'L':K L K K Sleep(y); break; case 'M':L L Sleep(y); break; case 'N':L K Sleep(y); break; case 'O':L L L Sleep(y); break; case 'P':K L L K Sleep(y); break; case 'Q':L L K L Sleep(y); break; case 'R':K L K Sleep(y); break; case 'S':K K K Sleep(y); break; case 'T':L Sleep(y); break; case 'U':K K L Sleep(y); break; case 'V':K K K L Sleep(y); break; case 'W':K L L Sleep(y); break; case 'X':L K K L Sleep(y); break; case 'Y':L K L L Sleep(y); break; case 'Z':L L K K Sleep(y); break; case '1':K L L L L Sleep(y); break; //Zahlen 0-9 case '2':K K L L L Sleep(y); break; case '3':K K K L L Sleep(y); break; case '4':K K K K L Sleep(y); break; case '5':K K K K K Sleep(y); break; case '6':L K K K K Sleep(y); break; case '7':L L K K K Sleep(y); break; case '8':L L L K K Sleep(y); break; case '9':L L L L K Sleep(y); break; case '0':L L L L L Sleep(y); break; //Sonderzeichen case ':':L L L K K K Sleep(y); break; case ';':L K L K L K Sleep(y); break; case '?':K K L L K K Sleep(y); break; case '(':L K L L K Sleep(y); break; case ')':L K L L K L Sleep(y); break; case '=':L K L L K Sleep(y); break; case '+':K L K L K Sleep(y); break; case '-':L K K K K L Sleep(y); break; case '/':L K K L K Sleep(y); break; case '@':K L L K L K Sleep(y); break; case 'Ä':K L K L Sleep(y); break; case 'Ü':K K L L Sleep(y); break; case 'Ö':L L L K Sleep(y); break; } }
-
Die meisten Sachen hier sind nicht so komisch weil sie auf Teufel komm raus absichtlich versuchen komisch zu sein. Zum Beispiel diese ganzen ReturnTrueIfBooleanIsTrue() Funktionen, haha witz komm raus du bist umzingelt!
-
Das ist auch nicht schlecht: http://www.thedailywtf.com/forums/57053/ShowPost.aspx
Intrigued, he dug a little deeper into their stylesheets and learned that the developers were able to find a way to tie back together style and content within a technology designed to do the opposite ...
-
//*** ALPHA ENGIENE ***// //*********************// //LOADING-PLEASE WAIT**// //---ALL LOADED---*****// //---HAVE FUN!!!!__****// //BSP LOADING**********//* //BSP CREATE!**********// /*//MAPLOAD!**************&&//** //by gorbrecht alpha! //copyrigt 2001-5000 (for ever *ggg*)! //*/ #include <stdio.h> //gorbrecht engienen definiers #define MAXENGIENENNAME (1200.0l); #define GORBR_WAHR (TRUE); #define GORBR_FALCH (false); #define GORBR_NULL ( NULL ); #define GORBR_ENGIENSTART 45;//magische zahl-speicherofsett #define GORBR_ALPHA (42);//winkel //FONT-MODUHL #define GORBR_TEXT_RIGT(0x00000l+0); #define GORBR_TEXT_BIG (0x00000l+1); //alpha types definiren typedef int GORBRINT;typedef char GORBRCHAR;typedef float GORBRFLOAT;typedef long GORBRLONG; typedef double GORBRDOUBLE; //main engiene struct typedef struct{ GORBRINT alpha_init; GORBRCHAR* engienen_nam[800+MAXENGIENENNAMEN]; } GORBRECHTALPHAENGIENE; //prototype GORBRINT showtext(GORBRCHAR* text,GORBRINT moduss); //main gorbrecht alpha engiene init GORBRECHTALPHAENGIENE engienen_inizialisiere() { //gorbrecht engienen inizialisier //MAIN______________--------***** //achtung--- erster teil--- //BILdSCHIRM ZEIGEN showtext("gorbrecht alpha engiene wird inizilaiert! BITTE WACHTEN!!!!!!",GORBR_TEXT_BIG); //besonders wichtig - pointer alokiern GORBRECHTALPHAENGIENE *engien; engien=(*GORBRECHTALPHAENGIENE)(malloc(sizeof(GORBRINT)))+GORBR_ENGIENSTART; //wenn engien nicht inizilisirt ist wird fehler gezeigt //if(((engien*)(=GORBR_FALCH); for(a=0;a<GORBR_ENGIENFORZAELER;a--){mesage_zeigen();} if(engien=GORBR_NULL){showtext("GORBRECHT ENGIENE ALPHA KONNTE NICHT INIZIALISIERT!_ kucken sie nach ob im PC alles OK ist!!!!!! manchmal_ kann da nähmlich zum beichpiel ne karte locker sein!!!!!!!!_ einfach mal kucken - scahdet ja nix!!! ;)", GORBR_TEXT_RIGT); //wahr wenn falch also kapuutt engien return GORBR_WAHR; } //engien ist oK!!!!!; return GORBR_FALCH; } ///**************************************___________________ //GORBRECHT ALPHA ENGIENE_____ FONT MODUHL__________________ // LOADING!!!!!!!!!!!!!!!!!!!!! /*_________________________________ FUNKTION ZUM schreiben text */ GORBRINT showtext(GORBRCHAR* text,GORBRINT moduss) {///TEXT VARS GORBRINT curs_XX, curs_XY, curs_YX, curs_YY;//cursor vars(xx-xy-yx-yy => 2. kwadrant)) GORBRDOUBLE steigung;; //steigung berechnet steigung=(curs_XX-curs_YY)/(curs_YX-curs_YY)*cos(GORBR_ALPHA); //PIXEL PLOT ROUTINE______________ //BY TURBO PASCAL ________________PROG ->>> 1989(C) -> 1990(C) ignor wladwaskisak//RUSSLAND! //KOPIERE ROUTINE AUS TP PROk!!!!!! //vorsicht-----------------NICHT VERGESSE!! ===> exit wenn falch oder kaputtt //`PLOT_PIX1 GORBRCHAR* pix; pix=0xA000; (pix+(curs_XX+curs_YY)+12)=rand()%256;//zufalsfarbe //PLOT PIXEL2 (pix+(curs_YY+curs_YX)+12)=rand()%256+122;//zufalsfarbe//ANDRE FARBE return GORBR_FALCH; //***************** NOTIZ!!!!!!!!!*******************+/*/*/*/* //DRAN DENKEN: FREITAG UM ACHT UR ABENT MIT KATJANKA EßEN GEH!!!!!!!!!!!!!!!!!!!! //***************** WICHTIG!!!!!!!!!!!!! }
-
-
groovemaster schrieb:
volkard schrieb:
dem muß ich nicht zustimmen.
Das mit epsilon war ja auch nicht generalisiert zu verstehen. Wenn du für deine Zwecke sowas nicht brauchst, musst du es auch nicht benutzen.
Man verwendet diesen "Trick" ja nur mit Fliesskommazahlen.
In einer vernünftigen numerischen Iteration fällt die Änderung welche die Iteration in jedem Schritt macht monoton.
Darum schreibt man was in der Form:
while(true) {
//blubb
if(Grosse_Lösung + Kleine_Änderung == Grosse_Lösung) break;
}Die Idee hinter dieser Lösung ist immer die maximale Genauigkeit des Systems wo das Programm läuft zu verwenden. MATLAB zum Beispiel rechnet genauer in kompiliertem als in interpretiertem Kode.
PS: Schreibt man Kode oder Code?
-
Hier im Forum gibt es auch einen WTF. Auf der Seite wo man den Beitrag schreibt:
<input type="hidden" name="bin_immer_true" value="1" />