Over the years, many gross hacks have been created to determine what header
files are available. Just as #ifdef is the solution to discovering if something
is defined, there should be a built-in solution for discovering if something is
successfully included. Ultimately this should be presented to the ISO for
standardization as part of both C and C++.

There are many possible ways this could work.

Idea #1

#tryinclude <foo.h> FOO // defines foo if include worked

Idea #2

#ifinclude <foo.h>
#endif


-- 
           Summary: no way to safely attempt an #include which may fail
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: acahalan at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29245

Reply via email to