The C preprocessor (cpp) is the preprocessor for the C programming language. In many C implementations, it is a separate program invoked by the compiler as the first part of translation. The preprocessor handles directives for source file inclusion (#include), macro definitions (#define), and conditional inclusion (#if). The language of preprocessor directives is not strictly specific to the grammar of C, so the C preprocessor can also be used independently to process other types of files.
| Property | Value |
| p:abstract
| - The C preprocessor (cpp) is the preprocessor for the C programming language. In many C implementations, it is a separate program invoked by the compiler as the first part of translation. The preprocessor handles directives for source file inclusion (#include), macro definitions (#define), and conditional inclusion (#if). The language of preprocessor directives is not strictly specific to the grammar of C, so the C preprocessor can also be used independently to process other types of files.
The transformations it makes on its input form the first four of C's so-called Phases of Translation. Though an implementation may choose to perform some or all phases simultaneously, it must behave as if it performed them one-by-one in order. (en)
- El preprocesador de C (cpp) es el preprocesador para el lenguaje de programación C. Es el primer programa invocado por el compilador y procesa directivas como #include, #define y #if. Estas directivas no son específicas de C. En realidad pueden ser usadas con cualquier tipo de archivo.
El preprocesador utiliza 4 etapas denominadas Fases de traducción. Aunque alguna implementación puede elegir hacer alguna o todas las fases simultaneamente, debe comportarse como si fuesen ejecutadas paso a paso. (es)
- :Cpp voi tarkoittaa jossain yhteyksissä myös koko C++-ohjelmointikieltä.
cpp (C preprocessor) on C ja C++-kielten esikääntäjä, jonka läpi lähdekoodi viedään ennen varsinaista käännösvaihetta. Esikääntäjää ohjataan lähdekoodissa #-merkillä alkavilla direktiiveillä kuten #include ja #define.
Ensimmäinen C++-kielen kääntäjä oli alkujaan vain kehittyneempi C-kielen esikääntäjä, mikä selittää osan C++-kielen nimeen sisältyvästä sanaleikistä. (fi)
- cpp (C Preprocessor) to standardowy preprocesor dla języków C i C++.
CPP udostępnia jedynie bardzo prostą funkcjonalność i w żaden sposób nie rozpoznaje składni języka przetwarzanego tekstu.
Ważniejsze funkcje to:
* Zdefiniuj stałą:
#define X Y
* Zdefiniuj makro:
#define X(argument) rozwinięcie
* Skasuj definicję:
#undef X
* Włącz plik (poszukiwany wg ścieżki standardowej, zdefiniowanej w konfiguracji programu cpp):
#include
* Włącz plik (poszukiwany wg ścieżki dodatkowej, definiowanej przez użytkownika):
#include "foo.h"
* Kompilacja warunkowa
#if warunek
Kod jeśli warunek jest spełniony
#else
Kod jeśli warunek nie jest spełnione
#endif
W języku C bardzo wiele ważnej funkcjonalności zależy od preprocesora. Użycie preprocesora jest jednak źródłem wielu problemów i pomyłek programistycznych. Poza szczególnymi przypadkami nie jest on też zintegrowany z językiem.
Z tego powodu w języku C++ dodano wiele funkcjonalności mającej na celu zastąpienie preprocesora.
Część tej funkcjonalności została potem dodana również do języka C.
Są to między innymi:
* Deklaracje stałych (poprzez słowo kluczowe języka const zamiast dyrektywy preprocesora #define) (również w C):
const int foo = 5;
* Funkcje rozwijane (inline) zamiast makr (również w C):
inline int abs(int x) {
if(x>0)
return x;
else
return -x;
}
* Szablony (tylko C++):
template swap(T &x, T &y) {
T tmp;
tmp=x;
x=y;
y=tmp;
}
Nadal jednak konieczne jest użycie preprocesora do włączania nagłówków bibliotek oraz do kompilacji warunkowej. (pl)
|
| p:hasPhotoCollection
| |
| p:quoteProperty
| |
| p:reference
| |
| p:wikiPageUsesTemplate
| |
| p:wikipage-es
| |
| p:wikipage-fi
| |
| p:wikipage-pl
| |
| rdf:type
| |
| rdfs:comment
| - The C preprocessor (cpp) is the preprocessor for the C programming language. In many C implementations, it is a separate program invoked by the compiler as the first part of translation. The preprocessor handles directives for source file inclusion (#include), macro definitions (#define), and conditional inclusion (#if). The language of preprocessor directives is not strictly specific to the grammar of C, so the C preprocessor can also be used independently to process other types of files. (en)
- El preprocesador de C (cpp) es el preprocesador para el lenguaje de programación C. Es el primer programa invocado por el compilador y procesa directivas como #include, #define y #if. Estas directivas no son específicas de C. En realidad pueden ser usadas con cualquier tipo de archivo. (es)
- :Cpp voi tarkoittaa jossain yhteyksissä myös koko C++-ohjelmointikieltä. (fi)
- cpp (C Preprocessor) to standardowy preprocesor dla języków C i C++. (pl)
|
| rdfs:label
| - C preprocessor (en)
- Preprocesador de C (es)
- Cpp (fi)
- CPP (pl)
|
| owl:sameAs
| |
| skos:subject
| |
| foaf:homepage
| |
| foaf:page
| |
| p:redirect
| |
| owl:sameAs
| |