Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!loft386!dpi From: dpi@loft386.UUCP (Doug Ingraham) Newsgroups: comp.lang.c Subject: Re: A solution to the multiple inclusion problem Summary: GNU gcc already has this. Message-ID: <521@loft386.UUCP> Date: 25 Oct 89 17:23:11 GMT References: <14240@well.UUCP> <1989Oct23.191634.6345@cs.rochester.edu> <4643@buengc.BU.EDU> Distribution: comp Organization: Lofty Pursuits, Rapid City, SD USA Lines: 36 In article <4643@buengc.BU.EDU>, bph@buengc.BU.EDU (Blair P. Houghton) writes: > How about ( in ): > > #pragma Never_Again > > Which tells the BlairTech/ANSI1.0 compiler that when it hits > a #include to read this file again, it should just ignore it. > > --Blair In GNU gcc this is already implemented as a pragma. #pragma once Seems like an obvious enough thing that every compiler vendor will eventually have their own incompatible version of this construct. I have put both constructs in my ANSI compatible header files so that they look like this: #pragma once #ifndef _STRING_H #define _STRING_H /* REST OF HEADER */ #endif In this way if compiled on a compiler that doesn't recognize the once pragma, it still has the desired effect. -- Doug Ingraham (SysAdmin) Lofty Pursuits (Public Access for Rapid City SD USA) uunet!loft386!dpi