C ++ garbage from entry to give up

 

A few days ago saw some braces wrapped C ++ code in an article (probably longer follows)

 

{

    // necessary preprocessed code ... it it it it it it ...

    int main ()
    {
         // body of code ... it it it it it it ... 
    }

}

 

I was forced to look ignorant, this is God horse syntax, compiles? Ever since I put this code into my Dev COPY compiler, Amazing! Actually been successfully compiled, run no mistake! I whim, if we can put some garbage in the code is not an error would not be a very loaded to force things, so they have the following code

 

#include<iostream>

using namespace std;

int main ()
{
    // I was a face with a roll of garbage 
    ' * ' ; { 1 == ' \\ ' + ' ` ' (? ' $ ' ): 1 ; / * * * / ~ ~ ~ ~ !!! ((+ - + - 0001 / '\' '| . 1 / 0x9 ));} ;;; qdsojntbz: /// 0] = D \ @ W F | E% SV) VS $% ^ & * D (#
    
    // I was a hand knocking code 
    cout << " Happy New Year ah! " << endl;
    
    return 0;
}

 

The above code COPY into your compiler where to run, you will find it not only passed the compiler, but also successfully exported a "Happy New Year ah!" This shows that those above garbled in line with C ++ syntax, and that in the end what's not Code grammatical meaning of it, after my ten minutes of testing, here to do a summary (If you find errors or supplementary Please comment area below or by mail bulletin to tell me, Liga and more!)

 

The first is the easiest comments (annotations readers never learned not worry, I will specifically later write an article to explain the comments), / *** / and /// comments are common landscaping tips, where / *** / * the second and the last /// / is a comment content is automatically omitted the compiler, so it will not cause any errors, I can write comments like the following

 

///////////////////////////// //
 ///   / *                      /// 
///   * editor at January 14, 2020 day    /// 
///   * edit Space Time by      /// 
///   / *                      /// 
/////////////////////////// // //

 

Next is the statement of the block and the start and end of the character, the opening period of the story is put it, is the start symbol block {} is the terminator block, the block can be written into the code, you can not write any things (empty block), such as main () {return 0;} in {} is written to a return 0; block, the main () {} in {} is an empty block, the block code may be appear alone, so the following code is in line with the syntax

 

{
  Int main ()
  {{{{}}}}
}

 

Statement terminator; may also appear alone (an empty statement), so the following code is in line with the syntax

 

int main ()
{
          ;
        ;;;;
      ;;;;;;;
    ;;;;;;;;;;
}

 

The next is a literal, a literal statement may appear as a separate, additional priority for improving () can be set numerous layer, the following piece of code or grammatical

 

int main ()
{
    " C ++ is the best language in the world! " ;
     3.14159 ; 
(((
3.14159 )));
1 + 1;
to true + false ;
"your uncle" == "your uncle";
}

 

Remember not to appear + 1 This error (because 1 is the right value), read the above code, we'll take a look at this wonderful code

 

int main ()
{
    +-1;
}

 

It is neither + nor - stuff in the end is what the Ghosts, but actually, it is grammatical, where the + and - can be understood as positive and negative, it is actually + -1 -1, but because even the two + together becomes a + 1 (being given), two - together becomes --1 (will be error), it is necessary to write a + in such a literal - alternately write, I can still not clear reference to the following code

 

int main ()
{
    + 1 ;     // by 
    - 1 ;     // by 
    + - 1 ;     // by 
    + 1 ;     // error 
    - 1 ;     // error 
    - + 1     // error 
    + - 1 ;     // by 
    - + - + - + 1 ;     // through 
}

 

The last and most difficult to think of, first look at the following code

 

int main ()
{
    CppNB : 
}

 

Note that the terminator is behind CppNB: instead; I did not expect it, and this code is in line with the double Cheese Li syntax (no doubt, I was blind to knock the code is always grammatical), because the mark goto statement is: at the end, so long as you: before knocking garbled goto mark in line with the naming convention, it does not complain (in fact, naming conventions and naming variables goto mark is the same)

 

See here you probably have been able to read the beginning part of the code I used to roll the face, and if you still do not understand, it may be because you do not know these below:

 

1.C ++ literal 0 to the beginning of the octal

2.C ++ 0x to the beginning of the literal hexadecimal number

2. / is meant ÷

4. | a logical operator or

5.! Non-logical operators

6. ~ was a bitwise operator

-6. \\ is the escape character \

7. \ 'is the escape character'

8. 'may implicitly converted to its corresponding code ASCLL (I remember like 39)

9. ternary operator syntax is my judgment is true or false is ture to take me:? I take is false; (specifically your own Google)

0. I will not be counting

9. End point Like you can read the • ᴗ •

Guess you like

Origin www.cnblogs.com/spacetime/p/cpp1.html