Difference between revisions of "C"

From RogueBasin
Jump to navigation Jump to search
m (Stub)
(Main article - need someone to fill out C roguelikes (as opposed to C/C++ RLs))
Line 1: Line 1:
C is the third letter of abc
== Background ==


Please post a description of the C programming language in roguelikes if your project uses C or you have enough knowledge about it.
The '''C programming language''' is a standardized imperative computer programming programming language developed in the early 1970s by Ken Thompson and Dennis Ritchie for use on the UNIX operating system. It has since spread to many other operating systems, and is one of the most widely used programming languages. C is prized for its efficiency, and is the most popular programming language for writing system software, though it is also used for writing applications. It is also commonly used in computer science education, despite not being designed for novices.
 
== Language Characteristics ==
 
C is a relatively minimalist programming language that operates close to the hardware, and is more similar to [[assembly language]] than to most High-level programming languages.
 
C was created with one important goal in mind: to make it easier to write large programs with fewer errors in the procedural programming paradigm, but without putting a burden on the writer of the C compiler, who is encumbered by complex language features. To this end, C has the following important features:
 
* A simple core language, with important functionality such as math functions or file handling provided by sets of library routines instead
* Focus on the procedural programming paradigm, with facilities for programming in a structured style
* A simple type system which prevents many operations that are not meaningful
* Use of a preprocessor language, the C preprocessor, for tasks such as defining macros and including multiple source files
* Low-level unchecked access to computer memory via the use of pointers
* A minimalistic set of keywords
* Parameters that are always passed to functions by value, never by reference
* Function pointers, which allow for a rudimentary form of Closure and Polymorphism
* Lexical variable scoping
* Records, or user-defined aggregate datatypes (structs) which allow related data to be combined and manipulated as a whole
 
Some features that C lacks that are found in other languages include:
* Type safety
* Garbage collection
* Classes or objects
* An advanced type system
* Closures
* Generic programming
* Operator overloading
* Native support for multithreading and networking
 
== Roguelike Issues ==
 
A lot of RLs actually use "C++/--", which is basic C with some of the more useful [[Cpp]|[C++]] features. This list applies to those using strict ANSI C.
 
Pros:
* C is highly portable
* There are lots of open-source C RLs (so there are many examples)
* C is fast
* Interfaces exist for many graphics libraries
* Lots of people have made successful RLs in C, so you can too!
 
Cons:
* Lack of garbage collection means handling memory allocation by hand
* Lack of classes makes it hard to do an object-oriented design, limiting project flexibility (so you have to plan ahead)
* Basically you are using a 30 year old language and sometimes that shows when you reach for more advanced language features like generics, XML handling, or thread synchronization. 3rd party libraries exist to augment the language and overcome these shortfallings.
 
== C Roguelikes ==
 
C is the default language for roguelike development. There are a vast number of C roguelikes.
 
* [[Nethack]]
* [[Angband]]
 
== Related Links ==
 
[[Category:Programming languages]]

Revision as of 15:46, 28 August 2005

Background

The C programming language is a standardized imperative computer programming programming language developed in the early 1970s by Ken Thompson and Dennis Ritchie for use on the UNIX operating system. It has since spread to many other operating systems, and is one of the most widely used programming languages. C is prized for its efficiency, and is the most popular programming language for writing system software, though it is also used for writing applications. It is also commonly used in computer science education, despite not being designed for novices.

Language Characteristics

C is a relatively minimalist programming language that operates close to the hardware, and is more similar to assembly language than to most High-level programming languages.

C was created with one important goal in mind: to make it easier to write large programs with fewer errors in the procedural programming paradigm, but without putting a burden on the writer of the C compiler, who is encumbered by complex language features. To this end, C has the following important features:

  • A simple core language, with important functionality such as math functions or file handling provided by sets of library routines instead
  • Focus on the procedural programming paradigm, with facilities for programming in a structured style
  • A simple type system which prevents many operations that are not meaningful
  • Use of a preprocessor language, the C preprocessor, for tasks such as defining macros and including multiple source files
  • Low-level unchecked access to computer memory via the use of pointers
  • A minimalistic set of keywords
  • Parameters that are always passed to functions by value, never by reference
  • Function pointers, which allow for a rudimentary form of Closure and Polymorphism
  • Lexical variable scoping
  • Records, or user-defined aggregate datatypes (structs) which allow related data to be combined and manipulated as a whole

Some features that C lacks that are found in other languages include:

  • Type safety
  • Garbage collection
  • Classes or objects
  • An advanced type system
  • Closures
  • Generic programming
  • Operator overloading
  • Native support for multithreading and networking

Roguelike Issues

A lot of RLs actually use "C++/--", which is basic C with some of the more useful [[Cpp]|[C++]] features. This list applies to those using strict ANSI C.

Pros:

  • C is highly portable
  • There are lots of open-source C RLs (so there are many examples)
  • C is fast
  • Interfaces exist for many graphics libraries
  • Lots of people have made successful RLs in C, so you can too!

Cons:

  • Lack of garbage collection means handling memory allocation by hand
  • Lack of classes makes it hard to do an object-oriented design, limiting project flexibility (so you have to plan ahead)
  • Basically you are using a 30 year old language and sometimes that shows when you reach for more advanced language features like generics, XML handling, or thread synchronization. 3rd party libraries exist to augment the language and overcome these shortfallings.

C Roguelikes

C is the default language for roguelike development. There are a vast number of C roguelikes.

Related Links