Topic: extern "<name>" language names


Author: Christopher Eltschka <celtschk@physik.tu-muenchen.de>
Date: 2000/11/10
Raw View
Hans Aberg wrote:
>
> In article <8tmp5c$27ti$1@nef.ens.fr>, "Valentin Bonnard"
> <Valentin.Bonnard@free.fr> wrote:
> >> The question is what names one should allow, for example,
> >>   extern "pascal" <function> { ... }
> >>   extern "Pascal" <function> { ... }
> >> will refer to two entirely different languages, "pascal" and "Pascal".
> >
> >7.5/2:
> >
> >[Note: it
> >   is recommended that the spelling be taken from the document defining
> >   that language, for example Ada (not ADA) and Fortran or FORTRAN
> >   (depending on the vintage).
>
> Right, even though it might not be clear if one should use say "Haskell"
> or "Haskell 98", etc. (And what about Objective-C, which I think has no
> official definition, but which is commonly used together with C++?)
>
> But there are some more serious issues to consider (and on which I am not
> an expert), say how and when to initialize C++ global data, behavior with
> respect to exceptions, and the corresponding stuff in 7.5.2 for C++/other
> (specific) languages.

I think it would be a good idea to make a separate "language suite
standard", which gives additional constraints on language suites,
that is, on compilers for different languages which are intended
to work together.
This language suite standard would not only define canonical names
for the languages, but also demand some compatibility rules.
Those would range from linking rules (f.ex., the C compiler
should use the same linkage as extern "C" functions in the C++
compiler, or the demand that FORTRAN integer is the same as
either C++ int or C++ long), up to additional headers (f.ex.
a <fortran> header for interoperability of C++ with FORTRAN,
which defines certain types needed for compatibility) or
even conforming language extensions (f.ex. a __longlong type
for C++ implementations interoperating with C99). And of course,
it would contain runtime rules, linke those you mentioned.

The language suite standard would make demands for pairs of
languages, which have to be fulfilled by the languages if
the other language is in the suite as well.

The language suite standard would be the right place for
defining things like compatibility of C++ std::complex,
C complex and FORTRAN COMPLEX, mapping between C exceptions
and Ada exceptions, synchronisation between C++ output and
Pascal output, ...

Probably a first version would only describe a rather small
set of languages (so it has a chance to get out at all ;-)),
and would be extended to more languages in later versions.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]






Author: remove.haberg@matematik.su.se (Hans Aberg)
Date: Wed, 1 Nov 2000 16:46:23 GMT
Raw View
In article <8tmp5c$27ti$1@nef.ens.fr>, "Valentin Bonnard"
<Valentin.Bonnard@free.fr> wrote:
>> The question is what names one should allow, for example,
>>   extern "pascal" <function> { ... }
>>   extern "Pascal" <function> { ... }
>> will refer to two entirely different languages, "pascal" and "Pascal".
>
>7.5/2:
>
>[Note: it
>   is recommended that the spelling be taken from the document defining
>   that language, for example Ada (not ADA) and Fortran or FORTRAN
>   (depending on the vintage).

Right, even though it might not be clear if one should use say "Haskell"
or "Haskell 98", etc. (And what about Objective-C, which I think has no
official definition, but which is commonly used together with C++?)

But there are some more serious issues to consider (and on which I am not
an expert), say how and when to initialize C++ global data, behavior with
respect to exceptions, and the corresponding stuff in 7.5.2 for C++/other
(specific) languages.

  Hans Aberg      * Anti-spam: remove "remove." from email address.
                  * Email: Hans Aberg <remove.haberg@member.ams.org>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: "Valentin Bonnard" <Valentin.Bonnard@free.fr>
Date: Tue, 31 Oct 2000 18:18:47 GMT
Raw View
Hans Aberg wrote:

> This is a not to discussions in the late thread "Calling C++ from C":
>
> C++ has the hooks
>   extern "<name>" { ... }
>   extern "<name>" <function> { ... }
> which those that develops C++ compilers can use to allow for the export of
> functions with C++ code in the body to other computer languages.
>
> The question is what names one should allow, for example,
>   extern "pascal" <function> { ... }
>   extern "Pascal" <function> { ... }
> will refer to two entirely different languages, "pascal" and "Pascal".

7.5/2:

[Note: it
   is recommended that the spelling be taken from the document defining
   that language, for example Ada (not ADA) and Fortran or FORTRAN
   (depending on the vintage).

--
Valentin Bonnard

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: remove.haberg@matematik.su.se (Hans Aberg)
Date: Mon, 30 Oct 2000 19:30:20 GMT
Raw View
This is a not to discussions in the late thread "Calling C++ from C":

C++ has the hooks
  extern "<name>" { ... }
  extern "<name>" <function> { ... }
which those that develops C++ compilers can use to allow for the export of
functions with C++ code in the body to other computer languages.

The question is what names one should allow, for example,
  extern "pascal" <function> { ... }
  extern "Pascal" <function> { ... }
will refer to two entirely different languages, "pascal" and "Pascal".

It strikes me though that there should probably be another standard which
suggests standard ASCII names for computer languages. Then the next C++
standard could say that <name> above is expected to be from that standard.
This way, the C++ standrad needs not keeping track of other computer
languages.

  Hans Aberg      * Anti-spam: remove "remove." from email address.
                  * Email: Hans Aberg <remove.haberg@member.ams.org>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]