C/C++ = C#?

Tags:    c++

Hej, er C/C++ det samme som C# eller er der en forskel der er vigtig?



5 svar postet i denne tråd vises herunder
1 indlæg har modtaget i alt 2 karma
Sorter efter stemmer Sorter efter dato
det er overhovedet ikke det samme :) C# er en del af Microsofts .NET framework og minder en del om java i syntax. C/C++ er et "stand alone" sprog og er nok det bedste valg hvis du vil programmere spil og store applikationer. C# er efter min mening noget nemmere at gå til og hurtigere at kode.



Ok :D



C, C++ og C# er alle programmeringssprog.

C# er et sprog beslægtet med Java og er en del af .NET. C# er det mest anvendte sprog, når man skal lave løsninger på .NET platformen. Selv foretrækker jeg at bruge C++, men det er ikke særlig anvendligt, når man anvender .NET da C++ på .NET platformen er en MEGET modificeret udgave af C++, hvor syntax'en er meget anderledes fx den managed del, som også hedder C++/CLI. Derfor hvis du vælger C++ så vil jeg anbefale at du benytter native C++.


C# (see section on naming, pronunciation) is an object-oriented programming language developed by Microsoft as part of their .NET initiative, and later approved as a standard by ECMA and ISO. C# has a procedural, object-oriented syntax based on C++ that includes aspects of several other programming languages (most notably Delphi, Visual Basic, and Java) with a particular emphasis on simplification (fewer symbolic requirements than C++, fewer decorative requirements than Java [citation needed]).

C++ (generally pronounced /si pl?s pl?s/) is a general-purpose, high-level programming language with low-level facilities. It is a statically-typed free-form multi-paradigm language supporting procedural programming, data abstraction, object-oriented programming, and generic programming. Since the 1990s, C++ has been one of the most popular commercial programming languages.

Bjarne Stroustrup developed C++ (originally named "C with Classes") in 1983 at Bell Labs as an enhancement to the C programming language. Enhancements started with the addition of classes, followed by, among other features, virtual functions, operator overloading, multiple inheritance, templates, and exception handling. The C++ programming language standard was ratified in 1998 as ISO/IEC 14882:1998, the current version of which is the 2003 version, ISO/IEC 14882:2003. A new version of the standard (known informally as C++0x) is being developed.

C is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.[1] It has since spread to many other operating systems, and is now one of the most widely used programming languages. C also has had a great influence on many other popular languages,[2] especially C++, which was originally designed as an enhancement to C. It is the most commonly used programming language for writing system software,[3][4] though it is also widely used for writing applications.





Skal det så forstås sådan, at C++ er lavet af en dansker? Det må det vel næsten skulle. Men vi danskere er jo heller ikke HELT dårlige ;)



Skal det så forstås sådan, at C++ er lavet af en dansker? Det må det vel næsten skulle. Men vi danskere er jo heller ikke HELT dårlige ;)


Ja, oprindeligt er det lavet af en dansker. Det har udviklet sig en del siden og der er kommet flere *gode* ting til.

T* t = (T*) ptr;

En af de ting, der er tilføjet er en erstatning for den gamle C-style cast (se eksempel ovenfor) og man skal derfor i stedet bruge nedenstående.

T* t = reinterpret_cast<T>(ptr);
T* t = static_cast<T>(ptr);
T* t = const_cast<T>(ptr);
T* t = dynamic_cast<T>(ptr);

The C++ casting operators are intended to provide a solution to the shortcomings of the old C-style casts by providing:

* Improved syntax. Casts have a clear, concise, although somewhat cumbersome syntax. This makes casts easier to understand, find, and maintain.
* Improved semantics. The intended meaning of a cast is no longer ambiguous. Knowing what the programmer intended the cast to do makes it possible for compilers to detect improper casting operations.
* Type-safe conversions. Allow some casts to be performed safely at run-time. This will enable programmers to check whether a particular cast is successful or not.






Indlæg senest redigeret d. 02.02.2007 17:04 af Bruger #10448
t