C++

From Uncyclopedia, the content-free encyclopedia
(Redirected from C plus plus)
Jump to navigation Jump to search
C++
Paradigm Multi-paradigm: You name it we've got it unless it's useful
Designed by Bjarne Stroustrup
Stable release ISO/IEC 14882:2014 / 15 December 2015
First appeared 1983
OS cross-platform
Filename extensions .cc .cpp .cxx .c++ .hh .hpp .h++ .hxx
Discipline Severe typing
Website isocpp.org
Under the influence of
C, Medusa-2, ADA, Pascal, SNOBOL, ML
Bad influence on
ADA-95, D, Sumatra, Forth, C#, Rust, PHP, Javascript, Java, Go, FORTRAN, Matlab, assembly, BASIC, COBOL, R
Wikibooks
C=C+1 Programming at Wikibooks


C=C+1 (IPA:/si 'ikwəlz si pləs wan/) is a programming language derived from C by programming language algebra. It is one of the most successful practical jokes ever played on nerds who take seriously ideas like object oriented programming. It is also a pioneer of the technique of catching people off guard by introducing new features every five years or so that are too hard for the compilers to get right the first time, and that, even when they do get it right, are incompatible with the old language in surprising and unpredictable ways.

Other advanced features include pairs of keywords which look totally different but do almost exactly the same thing and having some keywords that get used everywhere to do totally different things.

It is, by definition, better than C,[1] but most people are too feeble-minded to learn it, and usually die of an aneurism when they begin to learn how to use templates.[citation needed] Given the complexity of the language, only the best programmers can actually use it, and because of the necessary skills, the programs are always smaller, faster, and better than programs written in other languages.

The standard abbreviation for C=C+1 is the letter C++

The language[edit]

The C++ language is a close relative of Gibberish, and is spoken by the people of Atlantis. Alas, nobody can study the language closely as Atlantis has yet to be found. Some nerds have suggested, however, that the language was spoken by early Aryans in India as an average Indian understands C++ better than his mother tongue. Regardless, here is a translation.

( (C++ : Language) == (Gibberish : language) ) && (Atlantis.people::operator<< == C++) &&!
(person->CanStudy(C++) == false);  Atlantis.location == NULL;  catch(...) {Translate(*this);}

"C++ derives from the same language as Gibberish and the people of Atlantis output to a C++ stream. However a person can study C++ is false. The location of Atlantis is unknown. Ignore exception and translate this."

The C++ language supports OO programming by providing support for abstraction, encapsulation, inheritance, polymorphism, metamorphism, symbolism, neopaganism, satanism, communism, non-determinism and severe masochism. It gives programmers more control by allowing them to overload and override functions, while being backwards-compatible with the C language's ability to overrun buffers.

History[edit]

The official mascot for C++ is an obese, diseased rat named Keith, whose hind leg is missing because it was blown off.

C=C+1 was undoubtedly a Cold War conspiracy. Ideas about who instigated it, and what their target was, vary considerably.

Some say C=C+1 was developed by Russian scientists who needed a computer language so difficult to comprehend that it would keep the wages of computer scientists high. The language managed to infiltrate the telephone infrastructure of the USA and allies via AT&T Bell labs.

Bell Labs was part of a secret CIA-funded scheme to bankrupt the Soviet Union by encouraging them to base all their software technology on a programming language so un-cost-effective that it would devastate their economy. Shortly after rumors about C and AWK reached top state planners, Kremlin officials were regularly discussing the "curly bracket language gap" that had opened up between the superpowers. The CIA plot was so successful that the scheme was quite openly adopted by the Reagan administration to win the cold war.

C=C+1's immediate predecessor was C with Specs. This added a new keyword, class, which did exactly what struct did, only with more class. This was all very well at first, but the demand for more powerful obfuscation features was growing in the early 1980s, and soon class was doing all kinds of things.

By the end of the decade, even this wasn't obscure or confusing enough, and there was very little more that class could do. It was time for a whole new keyword, and template added a whole new layer of confusion.

C=C+1 is born[edit]

C=C+1 is currently the bee's knees choice for programmers when it comes to the art of computer programming. Created to be the replacement of all other programming languages, it has mutated far too much to be controlled. It has gained an almost sentient mind. It actively seeks out new host computers, finding and destroying all other languages on the hard drive, including English.

With the added functionality of OOP, C=C+1 continues to be a severe threat to the computer world. Many have fallen victim to its merciless attacks on their PCs, losing most, if not all of their archived pornography and txt files.

Design principles[edit]

The C=C+1 language is a natural outgrowth of the Rule Of Three (Embrace, Extend, Extinguish) and the Rule Of Five (Override, Overload, Over-cast, Over-engineer, Overcharge). Several fundamental principles guide the development of the language:


It is anticipated that new language design principles will be added as deemed appropriate — that is, on a whim as suggested at a "standards committee" by a member whose employer already has an insurmountable lead over everyone else in implementing it and will wind up selling licenses to the others to be "compliant."

Not all programmers are at home using C=C+1 without a few years of retraining. And yet, it is a poor craftsman who blames his tool. That is why craftsman Bill Clinton never did, and Hillary continually blamed the various work-pieces.

Code example[edit]

You can write bad code in any language.
—Scott Meyers

The following is a small example of some dangerous C=C+1 code that, when compiled by Brazilian sweat shop children, it will donate all of Coca Cola's backup funds to charities around the world.

 #include <mutation.h>
 #include <iostream>
 #include <string>
 #include "evil.h"
 #include "coca-cola.h"
 
 // use the sexually transmitted disease namespace
 // be careful when using its functions across multiple programs
 using namespace std;     
 
 int main()
 {
    // decrypt the elephant konstant, or the program may spontaneously combust
    parse(ELEPHANT);
    // get the total amount of money
    const float& money = gCola.getMoney();
 
    try
    {
      CocaCola::charity::donate(money);
    }
    catch(...)
    {
      cout << "LOSERS!!!111!1!1" << endl;
      Evil::Common::killAll(); // It must be the [[apocalypse]]! Might as well kill everyone before [[Zeus]] does...
    }
    
    return 0; // everything worked fine! Have a great day :)
 }

As you can see from the complexity of the code above, it is very difficult to understand this language. Nevertheless, not all C=C+1 code is hard to learn. Consider the following typical "Hello world" program:

 #include <iostream>
 using namespace std;     
 
 int main()
 {
    cout << "Hello, World!" << endl;
    return 0; // it's very important, because you win, when ALL is Nothing ;}
 }

Microsoft's C++ compiler called Visual C++ is a little different:

 // whateverthenameis.cpp : Defines the entry point for my ass.
 //
 
 #include "stdafx.h"
 #include <iostream>
 
 int main()
 {
         using namespace std;
         cout << "Hello, World!" <<;
         return 0;
 }

Output:

Hello <error locating A Working Programme.exe>

Module structure[edit]

Also known as the "LEO" - linker error ocean. Like Goldilocks trying to find the porridge with the best specific heat. This header structure is overlinked:

LNK431**** ERROR "simple1.h": ______stdcall mishmash(scone, scone) void static already defined in "simple2.h" - ERROR
LNK431**** ERROR "simple1.h": ______stdcall mishmash(scone, scone) void static already defined in "starch.h" - ERROR
FATAL ERROR: Consult KB eubadeprogramar.hlp

Ooh, this one is underlinked:

LNK431**** UNRESOLVED EXTERNAL SYMBOL "simple1.cpp": ______stdcall mishmash(scone, scone) void static:
   See definition in "blech.h"
FATAL ERROR: You suck

This one is just right:

#if !defined(CRAMIT_H__7012E9AB_0584_4C2C_BEF9_8066666666DB1__INCLUDED_)
#define CRAMIT_H__7012E9AB_0584_4C2C_BEF9_8066666666DB1__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#pragma vsj_smart_mode 1
#pragma never_again_or_ill_smack_you
#endif // _MSC_VER > 1000

#ifdef HEADER_KARATE
   ____________ext_linkage void mishmash(void* scone, DANGLING* scone);
   ___________ext_linkage void runtime_type_safety(CLOWN* pDamnit);
#else
   #ifdef HEADER_DEFENDO
      #pragma breakayospine
      #include "crosscompile.mak"
   #else
      #define __SYSTEM
   #endif
#endif

#undef DANGER_BOMB
#undef CRASH_COMPILER

#endif // !defined(CRAMIT_H__7012E9AB_0584_4C2C_BEF9_8066666666DB1__INCLUDED_)

This veritable preprocessor armor is needed to combat the swarming masses of black and white garbage in the output screen, which is by design.

Language features[edit]

See also: Rube Goldberg

Classes and inheritance[edit]

A class can appoint another class to inherit its possessions when it expires. This is achieved by the lastwillandtestament keyword. Each class can also have a nextofkin relationship to other classes, which defines the behaviour when a lastwillandtestament has not been defined. If neither lastwillandtestament nor nextofkin have been defined, then C=C+1 will appoint a class at random.

Namespaces[edit]

A unique characteristic of C=C+1 is that it lets your friends handle your private parts. With the std or sexually transmitted disease namespace now in the language, it is essential to have your private parts protected during public orgies.

Data hiding[edit]

Data is something you should be ashamed of. C=C+1 offers the dedicated obfuscationist a plethora of ways of hiding the location of any data. With just a little work, it will become impossible for anyone else to see what your program does, or how it does it, with its data. All this is encapsulated, which is highly encouraged.

Exceptions[edit]

Ever since the invention of computers by Steve Jobs in 1972, advances in the designs of programming languages have led to better, more powerful languages that enable programmers to be more productive. C++ is an exception.

Most programming languages allow programs to be debugged after they are first written. C++ is an exception.

Smart pointers[edit]

Smart pointers are a revolutionary new construct that first appeared in C++ circa 2001. These new type of pointers are facilitated by language features such as operator overloading and the Standard Template Library (STL). They alleviate deficiencies with ordinary pointers such as dangling pointers and memory leaks, and with minimal memory or CPU overhead.

Originally called "training-wheels" pointers, the name was changed to "smart" pointers under pressure from C++ textbook peddlers, who were eager to maximize their sales of C++ books to gullible nerds. As training-wheels pointers have become more widely adopted, many C++ textbook peddlers have been able to relax, and retire in their solid gold houses.

Templates[edit]

Templates enable type safe, zero cost abstractions by enabling generic versions of algorithms to be utilized. Generic algorithms are the least expensive in the store; they come in black-and-white packages without illustrations, they taste just as good as name-brand algorithms, and if they malfunction, the manufacturer will cheerfully refund the full purchase price.

Type-safe zero-cost abstractions are the pinnacle aspiration of C++, the "Holy Grail" of this particular journey to the crucifix of engineering. By comparison, all other aspects of software are just minor details. Standards committees have literally pushed grandmothers down stairwells to accomplish this. Thus it is unavoidable that a veritable Holy War has erupted over the correct way to implement it.

Templates provide a powerful abstraction for programmers. For example, by using templates, the comprehensibility of compiler error messages is abstracted into oblivion. Also abstracted into oblivion are the precious hours of your life wasted waiting for your program to compile.

RAII & RTTI[edit]

These are two of the many abbreviations associated with the language. Some other commonly used abbreviations associated with C++ are SIOF, ODR, RVO, SFINAE, STL, PImpl, WTF, and OMG.

Lambdas[edit]

λλ Λ λ λ λ λΛλ λ. λλλλλλ.
λ Λ Λ λλλλλλ λ. Λ
λ λ λ
λΛλ λ λ Λ Λ λ λΛλ λ (λλλλλλλλ) λ Λ Λ λ.

Functors[edit]

"Functor" is a portmanteau of the words "function" and "tumor". Functors were discovered inside C++ during a routine examination, and tests confirmed them to be malignant. Unfortunately, they have not responded well to treatment with syntactic sugar placebos, and they grow rapidly, that is, until funding is terminated, thus killing the project.

Operator overloading[edit]

Operator overloading enables programmers to redefine the ordinary meanings of commonly used arithmetic and logic symbols. For example, the common addition operator symbol, '+' (plus), can be overloaded to also perform the operations of concatenation, subtraction, derision, de-capacitation, decimation, and much more. This makes the plus symbol extremely powerful. In fact, with such immense power, even enormous, complex business applications can be written entirely using only the plus symbol, and as a bonus, code readability and reuse are both increased, which is another positive added plus.

Polymorphism[edit]

Polymorphism is the word used to refer to the C++ language's fear and loathing of shapes.

Coding standards[edit]

The great thing about standards is that there are so many to choose from.
—Herb Sutter

Sometimes, coding in C++ means working with other programmers as part of a group, or team, and in these situations, having good coding standards is essential to success. Poor coding standards can result in project failure, so, it is strongly recommended that each member of the team should decide beforehand which language features he or she likes or dislikes, and produces their own unique, personal coding standard based on his or her preferences. Once these documents are completed, they should be neatly organized using appropriate fonts and checked for spelling mistakes. Team members who can create unique, personal coding standards documents (UPCS) that exceed three hundred pages in length are awarded bonuses.

Because C++ has so many features, no two coding standards should ever be the same, and this fact guarantees that each programmer on the team can contribute to the project with their own unique, quirky finesse, thereby maximizing the chances for success.

CppCon conferences[edit]

Attendees of CppCon 2016 react with euphoria to the announcement that a proposed new feature, 'Attributes for Namespaces', has been approved and shall be adopted in the official C++17 standard.

In an effort to promote the widespread adoption and use of C++, conferences known as "CppCon" occur in cities throughout the world. These conferences attract large numbers of people who attend the workshops and educational colloquia, often featuring well-known experts. Videos of the talks are available online for those who cannot attend in person.

Attendance at the conferences has grown steadily every year as C++ evangelists have spread the good word. Also, resistance to indoctrination has declined due to the new campaign of purifying non-believers with fire.

Criticism[edit]

There are no known criticisms of C++.

The future[edit]

The ISO standardization committee is expected to approve many exciting new features for the upcoming version, C++19. The accelerated pace of adding dangerous and experimental new features is due to recent competition from several newer languages such as Dee, Lust, Goo, and Allah. In response to this challenge, the rules governing the approval process have been relaxed, and new features no longer require a unanimous decision. Instead, voting conflicts among committee members are resolved by the best two out of three games of "Rock, Paper, Scissors".

Here are some of the coming features:

Concepts[edit]

Concepts are expected to be introduced sometime after 2017, as the implementation details of this new feature continue to be debated. Until then, users of the language will have to continue to make due with figments.

Meta-keywords[edit]

I never meta keyword I didn't like.
—Will Rogers

New meta-keywords such as non, un, and meta can be added as prefixes to existing keywords, making possible statements that were previously impossible. For example, in the following code:

     (un)mutable int i;

the meta-keyword un modifies the behaviour of the keyword mutable. The standard states that the resulting behaviour is undefined. However, in no case does it involve having the variable's value change. Declaring a variable to be unmutable avoids all manner of programming bugs caused by setting the variable to invalid values. The variable is effectively a read-only memory (ROM), without the annoying need for it to have an initial value.

Nodules[edit]

Nodules are expected to appear soon in the language's "std" (sexually transmitted disease) namespace. This is expected due to C++'s intimate relationship with Java. Once the nodules reach full size and are engorged with pus, they should burst open spurting and oozing "disease vectors" everywhere, which eventually dry and form an itchy crust.

Exception hiding[edit]

C++19 will introduce exception hiding. This powerful new feature, not available in any other language, is implemented with the new keywords footgun and gotcha. For programmers who worry about lawsuits from their customers, exception hiding - and virtual exception hiding - are welcome and valuable features.

Variable overloading[edit]

Variable overloading is a long overdue feature that will make more efficient use of the limited number of variable names that programmers can think of, which is, on average, only seven. So, for example, unique variables named 'i' can all be declared globally or in the same scope as shown here:

 int i;
 char i;
 float i;

Then in the program code, the compiler determines which 'i' is used in a particular statement by a combination of the global context, local context, explicit casts, hidden type conversions, psycholinguistics, and undefined behavior. This reduces bugs caused by programmers who inadvertently confuse variables with similar names, for example, such as 'i' and 'exposure_time'.

Notes[edit]

  1. ^  It's 1 better.

See also[edit]