• enigma (unregistered)
      char *pSpaceChar[8] = {
          "",             // No Space Characters
          " ",            // One Space Character
          "  ",           // Two Space Characters
          "   ",          // Three Space Characters
          "    ",         // Four Space Characters
          "     ",        // Five Space Characters
          "      ",       // Six Space Characters
          "       " };    // Seven Space Characters
    

    /* a marriage of 2 woefully bad concepts and an expansion of bad coding practice. This doesn't deserve to live near well-written code so we must continue the trend. Obviously we should use a nice, long switch to generate the required number of spaces to indent the paragraph... ;) */

    switch(indent_setting) (
    	case 0:
    		pSpaceChar = NULL;  // obviously, because we don't need it if there are no spaces to print... 
    		sprintf("%s%s",pSpaceChar[0], whateverContent);
    		break;
    	case 1:
    		sprintf("%s%s",pSpaceChar[1], whateverContent);
    		break;
    	case 2:
    		sprintf("%s%s",pSpaceChar[2], whateverContent);
    		break;
    	case 3:
    		sprintf("%s%s",pSpaceChar[3], whateverContent);
    		break;
    	case 4:
    		sprintf("%s%s",pSpaceChar[4], whateverContent);
    		break;
    	case 5:
    		sprintf("%s%s",pSpaceChar[5], whateverContent);
    		break;
    	case 6:
    		sprintf("%s%s",pSpaceChar[6], whateverContent);
    		break;
    	case 7:
    		sprintf("%s%s",pSpaceChar[7], whateverContent);
    		break;
    	case 8:
    		sprintf("%s%s",pSpaceChar[8], whateverContent);
    		break;
    	case 9:
    		sprintf("%s%s",pSpaceChar[9], whateverContent);
    		break;
    	default: 
    		sprintf("%s%s",pSpaceChar[indent_setting], whateverContent);
    		break;	
    }
    
  • anonymous (unregistered)

    this one goes with the christmas tree!!!

           ____
          {} _  \
             |__  \
            /____\
            \o o)\)_______
             (<  ) /#######\
         __{'~`  }#######|
       /    {     _}_/######|
     /      {    /   _|/  )####|
    /     \_~/  /_  \  |####|
    \______\/    \ | |####|
     \__________\|/####|
       |__[X]_____/ \###/ 
      /___________\
       |      |/        |
       |___/|___/
     _|   /_ |       /
    (___,_  (___,_)
    

    captcha = smile ... SMILE! It's CHRISTMAS in February

  • (cs)

    The real WTF is that you don't need separate strings, the C language is perfectly happy if you overlap them:

    char Spaces[] = " ";

    #define GimmeSpaces(HowMany) Spaces[ sizeof( Spaces ) - HowMany );

  • (cs)

    #include <stdio.h> #include <stdbool.h>

    char *pSpaceChar[8] = { "", // No Space Characters " ", // One Space Character " ", // Two Space Characters " ", // Three Space Characters " ", // Four Space Characters " ", // Five Space Characters " ", // Six Space Characters " " }; // Seven Space Characters

    int back=0 ; int forth=1 ;

    int main(void) { int way=forth ; int i=-1 ; while(true) { if(way) ++i ; else --i ; printf("%sWTF!!!\n", pSpaceChar[i]) ; if (i==0) way=forth ; else if (i==7) way=back ; } }

  • kilroy (unregistered)
              \\\ /// 
             ( @ @ ) 
    ....o00o.(_).o00o...
    

    kilroy was here

    captcha = kungfu .. kilroy and kungfu have the same number of characters and both start with k

  • (cs)

    Okay, I'm going to start a new rabbit trail here. Years ago I was using a very brain-dead C compiler to develop embedded code for a product that used the Motorola 6809 processor (8-bit with with 64 kbyte max address space). Running out of code space (i.e. EPROM), I went searching for ways to optimize for space. I discovered much of my precious code space being occupied by long (32-bit) constants with values of zero, one, and two. So, I gave the compiler a bit of help by defining

    const long ZERO = 0; const long ONE = 1; const long TWO = 2;

    and then using them in place of the literal values. This change alone freed up over a kbyte of code space.

    I can easily see pSpaceChar being used for the same purpose.

  • facetious (unregistered) in reply to David
    David:
    static char *sevenSpaces = "       ";
    char *pSpaceChar[8] = {
        eightSpaces + 7,
        eightSpaces + 6,
        eightSpaces + 5,
        eightSpaces + 4,
        eightSpaces + 3,
        eightSpaces + 2,
        eightSpaces + 1,
        eightSpaces
    };

    stdin:3: error: `eightSpaces' undeclared (first use in this function) stdin:3: error: (Each undeclared identifier is reported only once stdin:3: error: for each function it appears in.)

  • Joshua (unregistered)

    'rap'. Not 'bad wrap'. A bad wrap is a burrito with salad dressing.

  • anonymous guy (unregistered) in reply to skztr
    skztr:
    Well, perhaps I'm wtfing. I did this a couple months ago. (not global)
    ...
    sprintf(acRec, "/*%.66s*/", pDashes);
    sprintf(acRec, "/*%.66s*/", pSpaces);
    

    If I'm WTFing here, let me know. ...

    For the spaces you can just do:
    sprintf(acRec, "/*%66s*/", "");
    
    I don't know of an easy way for non space chars though.
  • freakshow (unregistered)

    I also hate the pointless comments for the code. I bet the person then failed to comment some other, more complicated sections of code.

  • Yeah Right (unregistered)

    Obviously, this was done so that the spaces could be localized properly for other cultures. If you didn't realize that immediately, you're an insensitive bastard.

    Think globally, act ridiculously.

  • Tim (unregistered) in reply to RogerC

    Very large Atari BASIC programs used to use the same tricks. A token for a variable took up less space than a constant, so at the beginning of the program, you'd see something like this:

    100 N0=0: N1=1: N2=2: N3=3: N4=4

    . . .

    190 N100=N10*N10

    etc. Those variables would then be used for calculations. Atari BASIC had a limit of 128 variables, so you could get quite a few common numbers replaced with variables and still have enough left over for the actual program.

  • Boner (unregistered)

    xmas tree wins

  • (cs)
    int my_strlen(char *s) {
      for (int i=0; i<8; i++) {
        if (strlen(s) == strlen(pSpaceChar[i]))
          return i;
      return FILE_NOT_FOUND;
    }
    
  • (cs) in reply to Tim
    Tim:
    Very large Atari BASIC programs used to use the same tricks. A token for a variable took up less space than a constant, so at the beginning of the program, you'd see something like this:
    Dang it, I was about to post that!

    Yup, all numbers in Atari 8K Basic were 6-byte floats, vs 1 (2?) bytes to reference a variable. I think it might have also been faster to reference numbers this way, but don't quote me on that.

    Atari Basic was pretty amazing for its time. Sure there weren't any string arrays, but any one string could be as large as memory!

  • Builder (unregistered)

    Could be a poor way to make fixed width values for a flat file instead of using sprintf to do it for ya.

  • Alejandro (unregistered) in reply to Anonymous

    Actually, I think this Captcha thing started with this Pop-up Potpourri:

    http://thedailywtf.com/Articles/Pop-up_Potpourri_0x3a__Announced_By_God.aspx

    Loook one of the latest

  • missing (unregistered) in reply to DJ Hirko
    DJ Hirko:
    How about it being a char * instead of a const char *, too? String literals are const char *'s.
    unfortunately, they are not. but still, you cannot write to them.
  • Orlando (unregistered)

    Where is the WTF? This array is useful when you frequently have to write certain amounts of blanks, e.g. when you want to indent each output line.

  • missing (unregistered)

    I am afraid I feel to see the wtf in the array of spaces. But if anyone can show me a way to get such strings of spaces (for some applications you could need quite a few very often) without having to assemble them at runtime, Im willing to learn...

  • facetious (unregistered) in reply to missing

    sprintf(mystring,"%7s",otherstring);

    This will pad any string with up to 7 spaces (on the left). Use -7 instead if you want the padding on the right.

  • facetious (unregistered)

    Obviously the way to use this array is:

    char *pSpaceChar[8] = { "", // No Space Characters " ", // One Space Character " ", // Two Space Characters " ", // Three Space Characters " ", // Four Space Characters " ", // Five Space Characters " ", // Six Space Characters " " }; // Seven Space Characters

    int getPadding(char *mystring){ for(int i=0; i<8; i++){ sprintf(test1,"%7s",mystring); sprintf(test2,"%s%s",pSpaceChar[i],mystring); if (strcmp(test1,test2) == 0) return i; } return -1; }

    int main(){ char *mystring = "asdf!"; printf("%s%s",pSpaceChar[getPadding(mystring)],mystring); return 0; }

  • Adam (unregistered)

    Addition!

    const char * pSpaceChar [] = {
    "", /* 0 */
    " ", /* 1 */
    /* ... */
    "          ...         " /* 65535 */
    };
    
    int add(short a, short b)
    {
        char acc[131070];
        strcpy(acc, pSpaceChar[a]);
        strcat(acc, pSpaceChar[b]);
        return strlen(acc);
    }
    
  • missing (unregistered) in reply to facetious
    facetious:
    sprintf(mystring,"%7s",otherstring);

    This will pad any string with up to 7 spaces (on the left). Use -7 instead if you want the padding on the right.

    As I said *without* assembling it at runtime. sprintf *is* assembling at runtime, its time complexity is scaling with the number of spaces you want.
  • (cs)

    I know! The initialisation is the real WTF! It should look like this:

    unsigned long long int nspaces[8]= { 0LL, 32LL, 8224LL, 2105376LL, 538976288LL, 137977929760LL, 35322350018592LL, 9042521604759584LL };

    printf("%s", &nspaces[i]);

  • rbonvall (unregistered)

    By using pointer arithmetic, one doesn't need all the values of the array, just the last one.

    char eightSpaces = "        ";
    
    void printSpaces(int howMany) {
        printf("%s", eightSpaces + 8 - howMany);
    }
    
  • (cs) in reply to Spoe
    Spoe:
    Why not this?
    sprintf(pDuration, "%-*s", pPointer, ((9 - iLength) * 2) + strlen(pPointer));

    Or:

    sprintf(pDuration, "%*s%s", " ", (9-iLength) * 2, pPointer);
    Maybe because it's so hard to read that nobody so far had noticed that your code crashes (you got the arguments order wrong), and also so hard to write, that even you had a problem with it?

    Moreover the original snippet tried to align the text to the CENTER, which probably is hard to do using "+9s" or ".9s" or just "9s" which many of you seemed to miss. In fact it failed to do so, because it should have been (9-iLength)/2 and not (9-iLength)*2.

    I think it should have been: sprintf(pDuration,"%*s%s", (9-iLength)/2,"", pPointer);

  • Aaron (unregistered)

    My C is a bit rusty (okay, extremely rusty) so you'll have to excuse me if this is hideously incorrect, but I'll give it a go anyway, designing for maximum inefficiency of course:

    #define false 0
    #define true 1
    
    typedef int bool;
    
    char *pSpaceChar[8] = {
      "",             // No Space Characters
      " ",            // One Space Character
      "  ",           // Two Space Characters
      "   ",          // Three Space Characters
      "    ",         // Four Space Characters
      "     ",        // Five Space Characters
      "      ",       // Six Space Characters
      "       " };    // Seven Space Characters
    
    void strtrim(char *s, char *buff)
    {
      int leftPadding = 0;
      int rightPadding = 0;
    
      for (int i = 0; i < strlen(s); i++)
      {
        char *spaces = new char[i + 1];
        spaces[0] = '\0';
        int remainingSpaces = i;
        while (remainingSpaces > 7)
        {
          strcat(spaces, pSpaceChar[7]);
          remainingSpaces -= 7;
        }
        strcat(spaces, pSpaceChar[remainingSpaces]);
    
        bool isNumSpacesEqual = true;
        for (int j = 0; j < i; j++)
        {
          if (spaces[j] != s[j])
          {
            isNumSpacesEqual = false;
            // "break" intentionally omitted here
          }
        }
    
        delete [] spaces;
        
        if (isNumSpacesEqual)
        {
          leftPadding = i;
        }
      }
    
      for (int i = strlen(s) - 1; i >= 0; i--)
      {
        char *spaces = new char[strlen(s) - i];
        spaces[0] = '\0';
        int remainingSpaces = strlen(s) - i - 1;
        while (remainingSpaces > 7)
        {
          strcat(spaces, pSpaceChar[7]);
          remainingSpaces -= 7;
        }
        strcat(spaces, pSpaceChar[remainingSpaces]);
    
        bool isNumSpacesEqual = true;
        for (int j = strlen(s) - 2; j >= i; j--)
        {
          if (spaces[strlen(s) - 2 - j] != s[j])
          {
            isNumSpacesEqual = false;
            // "break" intentionally omitted here
          }
        }
        
        delete [] spaces;
    
        if (isNumSpacesEqual)
        {
          rightPadding = strlen(s) - i - 1;
        }
      }
      
      for (int i = leftPadding; i < (strlen(s) - rightPadding); i++)
      {
        buff[i - leftPadding] = s[i];
      }
      buff[strlen(s) - leftPadding - rightPadding] = '\0';
    }
    

    (Please note that my never saving the value of strlen(s) is also intentional!)

  • nobody (unregistered)

    char pSpaceChar=" "; / 7 spaces */

    /* Adjust for decimal point */ sprintf(pDuration, "%s%s", &pSpaceChar[(9-iLength) * 2], pPointer);

    If you know that the string is stored as a sequence of spaces terminated by a null, then you can see that by pointing at different starting point of the strings would give you a different length.

    This is a shorter and faster solution than a for-loop and is closest to the intention of the original code.

  • facetious (unregistered) in reply to missing
    missing:
    As I said *without* assembling it at runtime. sprintf *is* assembling at runtime, its time complexity is scaling with the number of spaces you want.

    If you want to save at runtime, use a single character string and take a slice of it (as described above).

    Or .. I guess .. you could ..

    char SEVEN_SPACES[8] = "       ";
    #define SPACES(x) (SEVEN_SPACES+7-x)
    
  • T Veesenmayer (unregistered) in reply to Zylon

    Same on a ZX Spectrum. Number representation expanded numbers (don't remember exact byte count), while builtin constants such as

    PI
    were tokenized to single bytes. So space-constrained BASIC code had plenty of constant expressions like
    PI-PI
    and
    PI/PI
    which still took way less bytes than storing a literal zero or one. Don't remember how much the calculations cost.

  • Coyne (unregistered)

    My C is a bit rusty (downright decripit) but wouldn't something like this do exactly the same thing as the original code?

      char p[10] = "         ";
      sprintf(pDuration, "%s%s", p + ilength*2, pPointer);
    
    

    Or maybe even a one-liner like this?

      sprintf(pDuration, "%s%s", "         " + ilength*2, pPointer);
    
  • (cs) in reply to Anonymous
    Anonymous:
    Hmm, 8 different strings... Surely this is some (even more!) esoteric dialect of brainfuck?
    Like Whitespace.
  • (cs) in reply to missing
    missing:
    facetious:
    sprintf(mystring,"%7s",otherstring);

    This will pad any string with up to 7 spaces (on the left). Use -7 instead if you want the padding on the right.

    As I said *without* assembling it at runtime. sprintf *is* assembling at runtime, its time complexity is scaling with the number of spaces you want.

    Is it? Do you have any evidence that sprintf's time complexity is scaling with the number of spaces you want? How is copying 66 characters from an array any fast than copy one character 66 times? In either case you have to "assemble" it at runtime. And in both cases you are already calling sprintf. Why not use sprintf for what it is built for (formatting strings)???

  • hamstray (unregistered)

    class SpaceChar { public: const char* operator[] (size_t n) {

        void* p = (void*) rand();
        memset(p,' ',n);
        p[n] = 0;
        return p;
    }
    

    };

    SpaceChar pSpaceChar;

  • Stephen Hurd (unregistered)

    Of course, for maximum clarity, it should have been written:

    sprintf(pDuration, "%s%s", ((9-iLength) * 2)[pSpaceChar], pPointer);

  • Pete (unregistered)

    I had to use something like this once to format text. A program we interfaced with took exactly 4 characters for a message. The message could, however, be less than 4 characters. The rest had to be padded with spaces.

    string CreateMessage(const string &Message)
    {
       static const char *Spaces[4] = { 
          "    ", "   ", "  ", " "
       };
       
       if (Message.size() >= 4) {
          return Message;
       }
    
       return (Spaces[Message.size()] + Message);
    }
    

    So I don't really understand what the problem with this code is necessarily.

  • brendan (unregistered)

    the funny thing is that people haven't realized is that if iLength <= 4 or iLength > 9, it will fail.

    Is it just me or is it that there are more people who don't have a clue what there doing.

    anyway just a suggestion (I know that this does not exactly fit problem, but think about this. If this were to be printed to the screen, the original line wouldn't line up all of the time): sprintf(pDuration, "%18s", pPointer);

  • Brewbuck (unregistered) in reply to missing
    missing:
    As I said *without* assembling it at runtime. sprintf *is* assembling at runtime, its time complexity is scaling with the number of spaces you want.

    If the spaces are being used for padding, then the number of spaces to use has to be computed at runtime anyway (since you don't know how wide the value you'll be printing is). Now, if you have some information that allows you to compute this width without calling strlen(), then you might be able to do it in fewer operations than sprintf() (which has to calculate the length of the string in order to properly pad it).

    But I assert that it doesn't practically matter. It's O(n) in either case, since you still have to PRINT EVERY CHARACTER which is O(n) in the number of characters, so any optimization you make cannot make it less than O(n).

    If the computation of the string length is truly such a bottleneck, it's probably time to step back and reexamine just what the hell is going on. Something is probably fundamentally wrong somewhere.

  • phs3 (unregistered) in reply to Joshua
    Joshua:
    'rap'. Not 'bad wrap'. A bad wrap is a burrito with salad dressing.

    Yeah, I was trying to convince myself that this was some sort of "wrapper" joke. But no, it's just...illiteracy.

    ...phsiii

  • StupidGuy (unregistered) in reply to Brewbuck
    Brewbuck:
    But I assert that it doesn't practically matter. It's O(n) in either case, since you still have to PRINT EVERY CHARACTER which is O(n) in the number of characters, so any optimization you make cannot make it less than O(n).

    If the computation of the string length is truly such a bottleneck, it's probably time to step back and reexamine just what the hell is going on. Something is probably fundamentally wrong somewhere.

    Well, I can't aggree on this - but University is looong over, so maybe it's because of this :-)

    1.) O(): As much as I remember and believe, O() is perfect for choosing the right /algorithm/... e.g. in the rule-of-thumb "O(1) is better than O(n)"... Well, it's a perfect rule of thumb :-)

    When you've found the correct algorithm - it's time to go to the /implementation/. And this one /does/ practically matter - at least sometimes :-)

    Take to functions with both O(n):

    int stupidsum ( int x )
    {
      int sum = 0, f;
      for ( f = 0 ; f < x ; f++ ) sum += f;
      return sum;
    }
    

    and compare it to this one:

    int morestupidsum ( int x )
    {
      int sum = 0, f;
      for ( f = 0 ; f < x ; f++ ) { sleep(1000) ; sum += f; }
      return sum;
    }
    

    Both have O(n), same results - but (how amazing) walltime differs :-)

    Back to the topic: the prebuilt space-string is just a form of loop-Unrolling. A stupid one (bad implemented), but it's a valid one.

    You could also say

    dosomething();dosomething();dosomething();
    dosomething();dosomething();dosomething();
    dosomething();dosomething();dosomething();
    dosomething();dosomething();dosomething();
    

    is [at least nowadays] completely stupid compared to

    int f;
    
    for (f = 0 ; f < 12 ; f++) {
        dosomething();
    }
    

    And I'd aggree as a rule of thumb to this. Actually, you /really/ have often to "loop-unroll" manually in the source (Yes, It's a wtf in itself) /nowadays/ - e.g. if you write "realtime" java-games for mobile Phones with J2ME.

    So there are even nowadays many applications, that need those "dirty tricks" - so I can't aggree on

    But I assert that it doesn't practically matter.
  • thomasvk (unregistered) in reply to HappyPanda
    HappyPanda:
    Martin:
    ...

    You forgot to define MAYBE. I suggest:

    MAYBE = "true"

    MAYBE = TRUE | FALSE; to be honest

    CAPTCHA: Pinball; I could do with some... starts MS Pinball

  • (cs)

    Well you could make snow to go with the Christmas tree:

    while(1) { printf("%s.", pSpaceChar(rand()&7)); }
  • iwan (unregistered) in reply to Joshua
    Joshua:
    'rap'. Not 'bad wrap'. A bad wrap is a burrito with salad dressing.

    'rep', actually. It's short for 'reputation'. Unless you're talking about 50 cent or the like. That is bad rap.

  • ratboy666 (unregistered) in reply to Anonymous

    int a, b, c; char buf[MAXNUM]; a = 1; b = 2; c = strlen(strcat(strcpy(buf, pSpaceChar[a]), pSpaceChar[b]));

    The rest is left for the reader -- this code hasn't been tested.

  • Tom (unregistered) in reply to Anonymous

    My very first program, written in BASIC for the Boy Scout computer merit badge, consisted of something like this:

    10 PRINT "XOOOOOOO" 20 PRINT "OXOOOOOO" 30 PRINT "OOXOOOOO" 40 PRINT "OOOXOOOO" 50 PRINT "OOOOXOOO" 60 PRINT "OOOOOXOO" 70 PRINT "OOOOOOXO" 80 PRINT "OOOOOOOX" 90 PRINT "OOOOOOXO" 100 PRINT "OOOOOXOO" 110 PRINT "OOOOXOOO" 120 PRINT "OOOXOOOO" 130 PRINT "OOXOOOO" 140 PRINT "OXOOOOOO" 150 GOTO 10

    (No idea if that's the right syntax for Basic, I haven't used Basic since then)

    I believe I called it "screensaver" or something. Somehow my merit badge advisor let me count it.

    Anyway, this snippet could be used for my awesome screensaver program...

  • (cs) in reply to StupidGuy
    StupidGuy:

    Back to the topic: the prebuilt space-string is just a form of loop-Unrolling. A stupid one (bad implemented), but it's a valid one.

    How is this loop unrolling? Passing in a prebuilt space string is akin to: while (*dst++ = *src++); (two increments, a copy, and a compare) And the formatted way is akin to: for(i = 0; i < N; i++) *dst++ = ' '; (two increments, a copy, and a compare)

    BOTH require loops. One is simpler and easier to maintain.

    Oh and the stupid moronic "loop unrolling" has the potential to cause a page fault as the prebuilt string of spaces might lay across a page boundary.

  • deadimp (unregistered)

    Psch, no one's used abused C++ with overly verbose and redundant OOP-programming.

    #include <cstdio>
    #include <setjmp.h>
    #include <string>
    
    namespace text {
     namespace token {
      namespace whitespace {
     template<typename TextTokenWhitespaceStruct_CharType,int TextTokenWhitespaceStruct_Length>
    struct TextTokenWhitespaceStruct {
     TextTokenWhitespaceStruct_CharType *x;
     static jmp_buf my_jump;
     TextTokenWhitespaceStruct() {
      TextTokenWhitespaceStruct_CharType __x=malloc(TextTokenWhitespaceStruct_Length+1);
      if (__x==NULL) { delete [] __x; throw new memory::MemoryException("No memory"); }
      if (TextTokenWhitespaceStruct_Length<0 || TextTokenWhitespaceStruct_Length>=8) { free(__x); TextTokenWhitespaceStruct_CharType TextTokenWhitespaceStruct_buffer[1024]; throw condition::ConditionException(std::string("Invalid length")+(std::string(itoa(TextTokenWhitespaceStruct_Length,TextTokenWhitespaceStruct_buffer,10))))); }
      try {
    			array::Array __a=array::Array::Construct(__x,TextTokenWhitespaceStruct_Length);
    			array::Array::Walk template<TextTokenWhitespaceStruct::TextTokenWhitespaceStruct_Assign>(__a.begin(),__a.end());
    		}
    		catch {array::ArrayOutOfBoundsException &e) {
    			setjmp(TextTokenWhitespaceStruct::my_jump);
    			for (int __i=0,int __b;__b=__i<TextTokenWhitespaceStruct_Length;__i++) {
    				new (&__x[__i]) TextTokenWhitespaceStruct_CharType(' ');
    			}
    			*(__x+__i)='\0';
    			return;
    		}
    		return;
    	 x=__x;
    	}
    	static void TextTokenWhitespaceStruct_Assign(TextTokenWhitespaceStruct_CharType &__c,int TextTokenWhitespaceStruct_index) {
    		__c=(TextTokenWhitespaceStruct_index==TextTokenWhitespaceStruct_Length-1 ? (TextTokenWhitespaceStruct_CharType)0 : ' ');
    	}
    	void TextTokenWhitespaceStruct_MakeString(std::string &__temp,int __count) {
    		text::token::whitespace::TextTokenWhitespaceStruct __temp(*this);
    		if (!__temp.x) { longjump(my_jump,256); new (&temp) TextTokenWhitespaceStruct(*this); }
    		if (__count!=TextTokenWhitespaceStruct_Length) goto end;
    		TextTokenWhitespaceStruct_Char
    		__temp=(std::string)__x;
    		end:
    		delete [] __temp.x;
    		return;
    	} }
    };
    typedef char ANSI_ASCII_CHAR_TYPE;
    std::string __temp;
    ANSI_ASCII_CHAR_TYPE* TextTokenWhitespaceStruct_List[]={
    	#define COUNT 0
    	(TextTokenWhitespaceStruct<ANSI_ASCII_CHAR_TYPE,COUNT>().TextTokenWhitespaceStruct_MakeString(__temp,COUNT+0),__temp.c_str()),
    	(TextTokenWhitespaceStruct<ANSI_ASCII_CHAR_TYPE,COUNT+1>().TextTokenWhitespaceStruct_MakeString(__temp,COUNT+1),__temp.c_str()),
    	(TextTokenWhitespaceStruct<ANSI_ASCII_CHAR_TYPE,COUNT+2>().TextTokenWhitespaceStruct_MakeString(__temp,COUNT+2),__temp.c_str()),
    	(TextTokenWhitespaceStruct<ANSI_ASCII_CHAR_TYPE,COUNT+3>().TextTokenWhitespaceStruct_MakeString(__temp,COUNT+3),__temp.c_str()),
    	(TextTokenWhitespaceStruct<ANSI_ASCII_CHAR_TYPE,COUNT+4>().TextTokenWhitespaceStruct_MakeString(__temp,COUNT+4),__temp.c_str()),
    	(TextTokenWhitespaceStruct<ANSI_ASCII_CHAR_TYPE,COUNT+5>().TextTokenWhitespaceStruct_MakeString(__temp,COUNT+5),__temp.c_str()),
    	(TextTokenWhitespaceStruct<ANSI_ASCII_CHAR_TYPE,COUNT+6>().TextTokenWhitespaceStruct_MakeString(__temp,COUNT+6),__temp.c_str()),
    	(TextTokenWhitespaceStruct<ANSI_ASCII_CHAR_TYPE,COUNT+7>().TextTokenWhitespaceStruct_MakeString(__temp,COUNT+7),__temp.c_str()) };
    ;;;;;;
    }}}
    
    //NOTE: This code is not guaranteed to compile, nor run as expected or unexpected. Have a nice day.
    

    Belongs more or less in a obfuscation contest, but eh, it's my shot at it. [Yeah, on the preview, the text editor started to screw up]

    I'd try to make it compile (except for the miscellaneous exception types), but I don't have enough time.

  • woohoo (unregistered)
    Global variables have gotten a bad wrap.

    I beg your pardon?

    the obvious truth about global variables aside - there are times when I do not get your native speaker's humor... I'd think that this should read "bad rep" (perhaps even "bad rap" would make some sense), but "wrap"??

    I can't wrap (!) my head around that, sorry...

  • iw (unregistered) in reply to Alejandro
    Alejandro:
    Actually, I think this Captcha thing started with this Pop-up Potpourri:

    http://thedailywtf.com/Articles/Pop-up_Potpourri_0x3a__Announced_By_God.aspx

    Loook one of the latest

    CAPTCHA: Wow this captcha is tangentially related to the current conversation!! It's almost as if someone made the captcha based on frequent topics of discussion on this website!!! omg so crazy

    and btw mine was WAFFLES! can you believe that!

Leave a comment on “Global Spaces”

Log In or post as a guest

Replying to comment #:

« Return to Article