[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_CHECK_FILES on /dev/stdin
From: |
David Fang |
Subject: |
Re: AC_CHECK_FILES on /dev/stdin |
Date: |
Fri, 31 Mar 2006 01:48:46 -0500 (EST) |
> Yes (without having tested it). A couple of very minor nits inline:
>
> > AC_DEFUN([AC_CXX_STD_IFSTREAM_DEV_STDIN],
>
> Please do not name your private macro with `AC_*'. That's the "name
> space" reserved for macros from Autoconf proper. It's commonly seen
> to use ones initials or a project prefix for that, e.g., df_CXX_*.
Oh yeah, thanks for the reminder -- I forget these things when no one is
checking me and keeping me inline! Bad Fang!
> Same issue with the cache variable prefix: df_cv_cxx_*.
> You are assuming an ISO C++ compiler with proper namespace support
> anyway, right? If not, there's a namespace macro in the Autoconf
> archive, and then doing something like
> #ifdef HAVE_IOSTREAM
> # include <iostream>
> #else
> # include <iostream.h>
> #endif
> //...
> #ifdef HAVE_NAMESPACES
> namespace std { }
> using namespace std;
> #endif
>
> will get this working on more systems. (Of course, you'd have to lay
> out your complete source code that way, too. The empty namespace
> addition is because IIRC one HP-UX has namespaces but doesn't define
> the std namespace.)
Yeah, for this project, at least, I'm restricting to ANSI/ISO std.
C++ compilers as much as possible while making *reasonable* accommodations
for deviations -- plus, I don't have access to many popular commercial C++
compilers. Keeping C++-heavy code happy across GNU g++-3.3 to 4.1 (-ansi
-pedantic-errors) alone already keeps me pretty occupied. (e.g.
HAVE_STL_REVERSE_ITERATOR_COMPARISONS, anyone?) I've got tons of checks
in place for tr1/* ext/* headers, prepared to update for when C++0x
'happens.'
> *snip*
> > if test "$ac_cv_cxx_std_ifstream_dev_stdin" = yes ; then
> > AC_DEFINE(HAVE_STD_IFSTREAM_DEV_STDIN, [],
> > [Define if std::ifstream(/dev/stdin) works])
> > fi
> > ])
> > dnl End of macro.
>
> Again a very minor nit, but it's customary (in Autoconf) to end macros
> with
> ])# MACRO-NAME
>
> which both signals the end of the macro well, and helps navigating. :-)
Ahhh, much to learn about such conventions, have I!
I'll probably go back and conform my existing macros to "standard
practice." I've got colleagues around copy-learning from an amateur like
me, so I'd better give them some good examples to work with.
Vielen Dank!
David
Re: AC_CHECK_FILES on /dev/stdin, J.T. Conklin, 2006/03/30