In the C and C++ programming languages, #pragma once is a non-standard but widely supported preprocessor directive designed to cause the current source file to be included only once in a single compilation. Thus, #pragma once serves the same purpose as include guards, but with several advantages, including: less code, avoiding name clashes, and improved compile speed. See the article on include guards for an example of a situation in which one or the other of these methods must be used.
| Property | Value |
| dbpprop:abstract
|
- In the C and C++ programming languages, #pragma once is a non-standard but widely supported preprocessor directive designed to cause the current source file to be included only once in a single compilation. Thus, #pragma once serves the same purpose as include guards, but with several advantages, including: less code, avoiding name clashes, and improved compile speed. See the article on include guards for an example of a situation in which one or the other of these methods must be used. The solution using include guards is given on that page; the #pragma once solution would be: File "grandfather. h" pragma once struct foo { int member; File "father. h" include "grandfather. h" File "child. c" include "grandfather. h" include "father. h"
- Del Lenguaje de programación C y C++, #pragma once es una directiva de Preprocesador de C no-estandar pero con un extenso soporte. Está diseñado para asegurar que el código fuente que lo invoca sea incluido una única vez. Así pues, #pragma once sirve al mismo propósito que la protección de macros, pero con una menor cantidad de código y sin la posibilidad de que lleguen a coincidir las identificaciones. El código con #pragma once sería: Archivo "abuelo. h" pragma once struct foo { int miembro; Archivo "padre. h" include "abuelo. h" Archivo "hijo. c" include "abuelo. h" include "padre. h"
- В языках программирования Си и C++ #pragma once — нестандартная, но широко распространенная препроцессорная директива, разработанная для контроля за тем, чтобы конкретный исходный файл при компиляции подключался строго один раз. То есть, #pragma once применяется для тех же целей, что и include guard, но требует меньше кода и не допускает возможности коллизии имен. В статье об include guard приводится пример ситуации, в которой нужно использовать тот или иной метод. Выходом является использование include guard, приведенное там же; Вариантом использования #pragma once может быть: File «grandfather. h» pragma once struct foo { int member; File «father. h» include "grandfather. h" File «child. c» include "grandfather. h" include "father. h"
- 在 C 和 C++ 程式語言中,#pragma once 是一個非標準但是被廣泛支援的前置處理符號,會讓所在的檔案在一個單獨的編譯中被include防範一次。以此方式,#pragma once 提供類似include防範的目的,但是擁有較少的程式碼且能避免名稱的碰撞。 請參考include防範裡其中一種狀況的範例或其他的使用方法。如下: 檔案「grandfather. h」 #pragma once struct foo { int member; 檔案「father. h」 #include "grandfather. h" 檔案「child. c」 #include "grandfather. h" #include "father. h"
|
| dbpprop:hasPhotoCollection
| |
| dbpprop:lc
| |
| dbpprop:reference
| |
| dbpprop:wikiPageUsesTemplate
| |
| rdfs:comment
|
- In the C and C++ programming languages, #pragma once is a non-standard but widely supported preprocessor directive designed to cause the current source file to be included only once in a single compilation. Thus, #pragma once serves the same purpose as include guards, but with several advantages, including: less code, avoiding name clashes, and improved compile speed. See the article on include guards for an example of a situation in which one or the other of these methods must be used.
- Del Lenguaje de programación C y C++, #pragma once es una directiva de Preprocesador de C no-estandar pero con un extenso soporte. Está diseñado para asegurar que el código fuente que lo invoca sea incluido una única vez. Así pues, #pragma once sirve al mismo propósito que la protección de macros, pero con una menor cantidad de código y sin la posibilidad de que lleguen a coincidir las identificaciones. El código con #pragma once sería: Archivo "abuelo.
- В языках программирования Си и C++ #pragma once — нестандартная, но широко распространенная препроцессорная директива, разработанная для контроля за тем, чтобы конкретный исходный файл при компиляции подключался строго один раз.
- 在 C 和 C++ 程式語言中,#pragma once 是一個非標準但是被廣泛支援的前置處理符號,會讓所在的檔案在一個單獨的編譯中被include防範一次。以此方式,#pragma once 提供類似include防範的目的,但是擁有較少的程式碼且能避免名稱的碰撞。 請參考include防範裡其中一種狀況的範例或其他的使用方法。如下: 檔案「grandfather. h」 #pragma once struct foo { int member; 檔案「father.
|
| rdfs:label
|
- Pragma once
- Pragma once
- Pragma once
- Pragma once
|
| owl:sameAs
| |
| skos:subject
| |
| foaf:page
| |