* [9fans] source header question
@ 2010-08-20 18:29 EBo
2010-08-20 20:28 ` Iruatã Souza
2010-08-21 2:24 ` Russ Cox
0 siblings, 2 replies; 11+ messages in thread
From: EBo @ 2010-08-20 18:29 UTC (permalink / raw)
To: 9Fans-list
I noticed that some of the plan9port .h files have "extern C" C++ compiler
directives:
#if defined(__cplusplus)
extern "C" {
#endif
...
Is this actually necessary since I thought C++ was not supported in Plan
9, et al.
Just checking...
EBo --
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9fans] source header question
2010-08-20 18:29 [9fans] source header question EBo
@ 2010-08-20 20:28 ` Iruatã Souza
2010-08-20 20:41 ` EBo
2010-08-21 2:24 ` Russ Cox
1 sibling, 1 reply; 11+ messages in thread
From: Iruatã Souza @ 2010-08-20 20:28 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
On Fri, Aug 20, 2010 at 3:29 PM, EBo <ebo@sandien.com> wrote:
>
> I noticed that some of the plan9port .h files have "extern C" C++ compiler
> directives:
>
> #if defined(__cplusplus)
> extern "C" {
> #endif
> ...
>
> Is this actually necessary since I thought C++ was not supported in Plan
> 9, et al.
>
> Just checking...
>
> EBo --
>
>
>
i guess you answered that yourself. does p9p run on Plan 9?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9fans] source header question
2010-08-20 20:28 ` Iruatã Souza
@ 2010-08-20 20:41 ` EBo
2010-08-20 21:05 ` Devon H. O'Dell
2010-08-20 22:33 ` Iruatã Souza
0 siblings, 2 replies; 11+ messages in thread
From: EBo @ 2010-08-20 20:41 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
> i guess you answered that yourself. does p9p run on Plan 9?
There a plenty of programs which are made to run under both p9p and plan9.
So, no the question is still open, but I will rephrase it.
Should any program which can run under p9p and plan9 ever be compiled with
g++ or another c++ compilers? Otherwise is it necessary to check for
__cplusplus?
EBo --
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9fans] source header question
2010-08-20 20:41 ` EBo
@ 2010-08-20 21:05 ` Devon H. O'Dell
2010-08-20 21:14 ` EBo
2010-08-20 21:56 ` Lyndon Nerenberg
2010-08-20 22:33 ` Iruatã Souza
1 sibling, 2 replies; 11+ messages in thread
From: Devon H. O'Dell @ 2010-08-20 21:05 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
2010/8/20 EBo <ebo@sandien.com>:
>
>
>> i guess you answered that yourself. does p9p run on Plan 9?
>
> There a plenty of programs which are made to run under both p9p and plan9.
> So, no the question is still open, but I will rephrase it.
>
> Should any program which can run under p9p and plan9 ever be compiled with
> g++ or another c++ compilers? Otherwise is it necessary to check for
> __cplusplus?
I think it may be for Sun compilers.
--dho
> EBo --
>
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9fans] source header question
2010-08-20 21:05 ` Devon H. O'Dell
@ 2010-08-20 21:14 ` EBo
2010-08-20 21:56 ` Lyndon Nerenberg
1 sibling, 0 replies; 11+ messages in thread
From: EBo @ 2010-08-20 21:14 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
>> Should any program which can run under p9p and plan9 ever be compiled
>> with
>> g++ or another c++ compilers? Otherwise is it necessary to check for
>> __cplusplus?
>
> I think it may be for Sun compilers.
Thanks Devon,
Is there anyone who can verify it? I gave away my old Sun workstations a
few years ago and cannot test it...
My reason for asking is whether I should continue adding all that to my
projects if it is fact not necessary.
EBo --
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9fans] source header question
2010-08-20 21:05 ` Devon H. O'Dell
2010-08-20 21:14 ` EBo
@ 2010-08-20 21:56 ` Lyndon Nerenberg
2010-08-20 22:05 ` Devon H. O'Dell
2010-08-21 13:21 ` erik quanstrom
1 sibling, 2 replies; 11+ messages in thread
From: Lyndon Nerenberg @ 2010-08-20 21:56 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
>> Should any program which can run under p9p and plan9 ever be compiled with
>> g++ or another c++ compilers? Otherwise is it necessary to check for
>> __cplusplus?
C is a subset of C++, so a C++ program can validly include native C code.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9fans] source header question
2010-08-20 21:56 ` Lyndon Nerenberg
@ 2010-08-20 22:05 ` Devon H. O'Dell
2010-08-21 13:21 ` erik quanstrom
1 sibling, 0 replies; 11+ messages in thread
From: Devon H. O'Dell @ 2010-08-20 22:05 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
[-- Attachment #1: Type: text/plain, Size: 544 bytes --]
I meant my understanding was that Sun's compiler is a C++ compiler. As
Lyndon points out, C is a subset. I may be wrong, but it can't possibly hurt
to leave it in. Any c++ compiler should be able to compile it.
On Aug 20, 2010 6:00 PM, "Lyndon Nerenberg" <lyndon@orthanc.ca> wrote:
>>> Should any program which can run under p9p and plan9 ever be compiled
with
>>> g++ or another c++ compilers? Otherwise is it necessary to check for
>>> __cplusplus?
>
> C is a subset of C++, so a C++ program can validly include native C code.
>
[-- Attachment #2: Type: text/html, Size: 694 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9fans] source header question
2010-08-20 20:41 ` EBo
2010-08-20 21:05 ` Devon H. O'Dell
@ 2010-08-20 22:33 ` Iruatã Souza
2010-08-20 22:42 ` EBo
1 sibling, 1 reply; 11+ messages in thread
From: Iruatã Souza @ 2010-08-20 22:33 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
On Fri, Aug 20, 2010 at 5:41 PM, EBo <ebo@sandien.com> wrote:
>
>
>> i guess you answered that yourself. does p9p run on Plan 9?
>
> There a plenty of programs which are made to run under both p9p and plan9.
> So, no the question is still open, but I will rephrase it.
>
> Should any program which can run under p9p and plan9 ever be compiled with
> g++ or another c++ compilers? Otherwise is it necessary to check for
> __cplusplus?
>
what I meant was that p9p is used on unix-like systems.
with that in mind, what if i wanted to:
% cat a.cc
#include <iostream>
#undef _XOPEN_SOURCE
#define NOPLAN9DEFINES
#include <u.h>
#include <libc.h>
#include <draw.h>
#include <geometry.h>
int
main(void)
{
Point3 x = {1,0,1}, y = {0,1,1}, z;
z = add3(x,y);
std::cout << z.x << std::endl;
std::cout << z.y << std::endl;
std::cout << z.z << std::endl;
return 0;
}
% g++ -I$PLAN9/include -c a.cc && g++ -o a a.o $PLAN9/lib/libgeometry.a
% a
1
1
2
without the extern definitions?
sorry if i was harsh.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9fans] source header question
2010-08-20 22:33 ` Iruatã Souza
@ 2010-08-20 22:42 ` EBo
0 siblings, 0 replies; 11+ messages in thread
From: EBo @ 2010-08-20 22:42 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
Iruatã,
Thanks for following up. Your example demonstrates that it is possible,
and maybe even desirable, to work in this way. So, I know to deal with it
appropriately.
Thanks again.
EBo --
> % g++ -I$PLAN9/include -c a.cc && g++ -o a a.o $PLAN9/lib/libgeometry.a
> % a
> 1
> 1
> 2
>
> without the extern definitions?
> sorry if i was harsh.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9fans] source header question
2010-08-20 18:29 [9fans] source header question EBo
2010-08-20 20:28 ` Iruatã Souza
@ 2010-08-21 2:24 ` Russ Cox
1 sibling, 0 replies; 11+ messages in thread
From: Russ Cox @ 2010-08-21 2:24 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
> I noticed that some of the plan9port .h files have "extern C" C++ compiler
> directives:
>
> #if defined(__cplusplus)
> extern "C" {
> #endif
> ...
>
> Is this actually necessary since I thought C++ was not supported in Plan
> 9, et al.
They're for compiling mpm.
Russ
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9fans] source header question
2010-08-20 21:56 ` Lyndon Nerenberg
2010-08-20 22:05 ` Devon H. O'Dell
@ 2010-08-21 13:21 ` erik quanstrom
1 sibling, 0 replies; 11+ messages in thread
From: erik quanstrom @ 2010-08-21 13:21 UTC (permalink / raw)
To: lyndon, 9fans
On Fri Aug 20 17:59:16 EDT 2010, lyndon@orthanc.ca wrote:
> >> Should any program which can run under p9p and plan9 ever be compiled with
> >> g++ or another c++ compilers? Otherwise is it necessary to check for
> >> __cplusplus?
>
> C is a subset of C++, so a C++ program can validly include native C code.
that's no longer correct. c is not a subset of c++.
however, there is a subset of c++ and a subset of c that
can be compiled by either compiler. trivially,
int catch, delete, friend, new, operator,
protected, public, template,
this, throw, try, virtual;
works in c but not c++.
- erik
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2010-08-21 13:21 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-20 18:29 [9fans] source header question EBo
2010-08-20 20:28 ` Iruatã Souza
2010-08-20 20:41 ` EBo
2010-08-20 21:05 ` Devon H. O'Dell
2010-08-20 21:14 ` EBo
2010-08-20 21:56 ` Lyndon Nerenberg
2010-08-20 22:05 ` Devon H. O'Dell
2010-08-21 13:21 ` erik quanstrom
2010-08-20 22:33 ` Iruatã Souza
2010-08-20 22:42 ` EBo
2010-08-21 2:24 ` Russ Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).