Guys,
I got the message below as a support request. I am not a C++ guy, and I have
never actually read the standard, so I'd like to get some feedback from people
who use it regularly. This user is requesting that I add:
#ifdef __cplusplus
extern "C"
{
#endif
....
#ifdef __cplusplus
}
#endif
To the main C API header files for C++ users. ATLAS's present approach is:
http://math-atlas.sourceforge.net/errata.html#CPPheadersFor the user suggestion, I have several questions:
(1) is the '__cplusplus' macro part of the C++ standard, or a gnu-specific
extension?
(2) Does the standard say what happens if you have nested extern "C"
declarations?
(3) What are people's feelings on this proposal?
Thanks,
Clint
>From
noreply@... Sun Jun 22 22:59:13 2008
Return-Path: <
noreply@...>
X-Original-To:
whaley@...
Delivered-To:
whaley@...
To:
noreply@...
From: "SourceForge.net" <
noreply@...>
Subject: [ math-atlas-Support Requests-2000447 ] Comment on FAQ "How about C++ header files for the C ..."
Content-Type: text/plain; charset="UTF-8"
X-SourceForge-Tracker-unixname: math-atlas
X-SourceForge-Tracker-trackerid: 379483
X-SourceForge-Tracker-itemid: 2000447
X-SourceForge-Tracker-itemstatus: Open
X-SourceForge-Tracker-itemassignee: nobody
X-SourceForge-Tracker-itemupdate-reason: Tracker Item Submitted
X-SourceForge-Tracker-itemupdate-username: Item Submitter
Date: Mon, 23 Jun 2008 03:59:01 +0000
X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on mail0.cs.utsa.edu
X-Spam-Level:
X-Spam-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham
version=3.0.2
Status: RO
Support Requests item #2000447, was opened at 2008-06-23 03:59
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=379483&aid=2000447&group_id=23725Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Problems during install
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Comment on FAQ "How about C++ header files for the C ..."
Initial Comment:
Hello,
I installed ATLAS to do some comparisons with
Intel MKL, AMD ACML etc. The test code is C++ and I am
testing on FreeBSD 7.0. I ran into the problem of
linking which is covered in the errata entry
"How about C++ header files for the C interfaces?"
I found this after I had worked out the problem
(and yes I did read the docs - just missed this one
as explained below).
A couple of comments:
1. The error occurs at link time but the errata
entry does not mention the link symptoms.
If you are an expert C++ programmer then maybe it
is obvious but for others I think that a note about
the symptoms would be useful (esp when searching
for symptoms on the web).
2. At the bottom of the entry it says
"If you are a C++ programmer using ATLAS, and think
differently, let me know."
Well I am not a C++ programmer but I cannot see why
the 'extern (C)' cannot be added to the cblas.h
header file with appropriate ifdefs e.g.
#ifdef __cplusplus
extern "C"
{
#endif
...
<the rest of cblas.h file>
...
#ifdef __cplusplus
}
#endif
This way it is no-op for C programs and will work
without C++ programmers having to add noise to their
code. It is also used in standard system files
'grep 'extern "C"' /usr/include/*.h'
3. As for the "Since ATLAS does not provide full OO
C++ interfaces, I am reluctant to raise the
expectation that it does by providing C++ specific
header files."
If the above ifdefs were added I do not believe
it will raise expectations. Since it is an
explicit 'extern "C"' you know they are C only
interfaces.
4. Of course if you do add the 'extern "C"' as
to the cblas.h file as suggested, existing code
would have additional enclosing 'extern "C"'.
I did a quick test and this does not appear to
cause any problems.
I have not used ATLAS enough to comment fully on its
usefulness but it does appear to be extremely useful
well written software.
(I did read the ATLAS FAQ ;-)
thanks
--
tony maher
tonymaher@...
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=379483&aid=2000447&group_id=23725**************************************************************************
** R. Clint Whaley, PhD ** Assist Prof, UTSA ** www.cs.utsa.edu/~whaley **
**************************************************************************
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php_______________________________________________
Math-atlas-devel mailing list
Math-atlas-devel@...
https://lists.sourceforge.net/lists/listinfo/math-atlas-devel