PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.cplus > compilation warning # pragma once
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
compilation warning # pragma once

Réponse
 
LinkBack Outils de la discussion
Vieux 02/07/2008, 06h07   #1
Subrat
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut compilation warning # pragma once

Hello,
I have used #pragma once in a header file.
During compilation I get a warning : #pragma once is obsolete.
How do I switch off this warning, without making any change to my make file?

Thanks in Advance,
Subrat


  Réponse avec citation
Vieux 02/07/2008, 06h20   #2
red floyd
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: compilation warning # pragma once

Subrat wrote:
> Hello,
> I have used #pragma once in a header file.
> During compilation I get a warning : #pragma once is obsolete.
> How do I switch off this warning, without making any change to my make file?
>
> Thanks in Advance,
> Subrat
>
>

Wrong group. #pragma's are implementation specific. How to disable
warnings is implementation specific. Try a group with microsoft or
vc in its name.

See FAQ 5.9 http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

  Réponse avec citation
Vieux 02/07/2008, 09h42   #3
Jim Langston
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: compilation warning # pragma once

"Subrat" <subrat.sahani@in.bosch.com> wrote in message
news:g4f2ep$cmu$1@news4.fe.internet.bosch.com...
> Hello,
> I have used #pragma once in a header file.
> During compilation I get a warning : #pragma once is obsolete.
> How do I switch off this warning, without making any change to my make
> file?


Easiest way, go into the header file, remvoe #pragma once and replace it
with the proper include guards.
#ifndef MYFILE_H
#define MYFILE_H

// header here

#endif

MYFILE_HEADER
is also sometimes used.


  Réponse avec citation
Vieux 02/07/2008, 10h45   #4
James Kanze
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: compilation warning # pragma once

On Jul 2, 10:42 am, "Jim Langston" <tazmas...@rocketmail.com> wrote:
> "Subrat" <subrat.sah...@in.bosch.com> wrote in message


> news:g4f2ep$cmu$1@news4.fe.internet.bosch.com...


> > I have used #pragma once in a header file.
> > During compilation I get a warning : #pragma once is obsolete.
> > How do I switch off this warning, without making any change to my make
> > file?


> Easiest way, go into the header file, remvoe #pragma once and replace it
> with the proper include guards.
> #ifndef MYFILE_H
> #define MYFILE_H


> // header here


> #endif


> MYFILE_HEADER
> is also sometimes used.


Many different conventions are sometimes used (inluding some
which are formally illegal, e.g. _MYFILE_H). The important
point is to avoid the risk of collisions. For this reason, most
libraries will try to munge the name of the library into the
guard (e.g. BOOST_..._INCLUDED); anything really professional
will probably include some sort of random sequence as well. (I
get toto_hh_20080702Jbqi2me5hF1pQrgColbxnIMk for a file toto.hh,
although I'll get something else if I create it again; the last
24 characters are generated from input from /dev/random.
Another possibility might be an MD-5 or SHA-1 digest of the
hostname and the full pathname from the root, or the filename,
programmer name and the current time and date.)

--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h07.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,13558 seconds with 12 queries