220 10731 <CALDL7dGNzXk-MBDkpLPJ3cqD1HxXjmRUfdxr23PYmLYaq=xh=Q@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Farid Mehrabi <farid.mehrabi@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Forward declaring names
Date: Wed, 21 May 2014 21:38:04 +0430
Lines: 190
Approved: news@gmane.org
Message-ID: <CALDL7dGNzXk-MBDkpLPJ3cqD1HxXjmRUfdxr23PYmLYaq=xh=Q@mail.gmail.com>
References: <20140509221552.GA32099@sara.home> <2057370.lyZjoukXSQ@tjmaciei-mobl4>
 <CALDL7dHK7gkUpSQA2yseuf77V5Ph8kMdRzA6Gq-ed2QOi7eupA@mail.gmail.com> <4711428.mIyGVVfVCn@tjmaciei-mobl4>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a113457dc63796a04f9ec0b4b
X-Trace: ger.gmane.org 1400692112 28595 80.91.229.3 (21 May 2014 17:08:32 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 21 May 2014 17:08:32 +0000 (UTC)
To: std-proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBC27JR6ERAOBBCV36ONQKGQEKEO3I4I@isocpp.org Wed May 21 19:08:27 2014
Return-path: <std-proposals+bncBC27JR6ERAOBBCV36ONQKGQEKEO3I4I@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-la0-f70.google.com ([209.85.215.70])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC27JR6ERAOBBCV36ONQKGQEKEO3I4I@isocpp.org>)
	id 1WnA0B-0003jR-Ib
	for gclcip-std-proposals@m.gmane.org; Wed, 21 May 2014 19:08:27 +0200
Original-Received: by mail-la0-f70.google.com with SMTP id el20sf1309187lab.1
        for <gclcip-std-proposals@m.gmane.org>; Wed, 21 May 2014 10:08:26 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=ZjM1tozat998h0LQ8riYN8mAc3rsOjU/dyFJyIeswdk=;
        b=l08UQUhlUwMvkeLlMj6GVxT6MJiDbrdZyhhaH3JTIf1rN/elIi/CKsDry77qo9a8+O
         P0ZmkxMHqQM387XcaHyLkalDiY/sXPQF7g6Q1G/tHSg2z00lYZAHuM28GiLsN+hiZrFG
         hhiEol50gdZc/q0iOl1Bg5lOcZTiEsq1UDG1NvD4vVOEbg2/07xZbcwx5GaFAycluMYj
         hyTfhNFObDF5MfBJ7gsssWk/6QP0SMDhdwMUGXaG9JtqEOC8v7RlHQ4X9ucShUnwuDfq
         9z9tz9UTkzYiTvR2rO06sQDafKllE6Wr0O7/5qfOy4R+moP81bGXWT8JaoioTeOY7Rpz
         9nDg==
X-Gm-Message-State: ALoCoQk5tLOlTb+xOG3kxppCtiqZWIYw1aP88sI604E7gALn7KItmT6ZYzLXelW7xNNFc6TPlYMi
X-Received: by 10.14.29.71 with SMTP id h47mr444352eea.6.1400692106873;
        Wed, 21 May 2014 10:08:26 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.152.5.4 with SMTP id o4ls163891lao.70.gmail; Wed, 21 May 2014
 10:08:25 -0700 (PDT)
X-Received: by 10.152.6.228 with SMTP id e4mr8928551laa.57.1400692105679;
        Wed, 21 May 2014 10:08:25 -0700 (PDT)
Original-Received: from mail-la0-x22a.google.com (mail-la0-x22a.google.com [2a00:1450:4010:c03::22a])
        by mx.google.com with ESMTPS id m3si7720154lba.41.2014.05.21.10.08.25
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 21 May 2014 10:08:25 -0700 (PDT)
Received-SPF: pass (google.com: domain of farid.mehrabi@gmail.com designates 2a00:1450:4010:c03::22a as permitted sender) client-ip=2a00:1450:4010:c03::22a;
Original-Received: by mail-la0-f42.google.com with SMTP id el20so1809493lab.29
        for <std-proposals@isocpp.org>; Wed, 21 May 2014 10:08:25 -0700 (PDT)
X-Received: by 10.152.203.168 with SMTP id kr8mr38798132lac.17.1400692105507;
 Wed, 21 May 2014 10:08:25 -0700 (PDT)
Original-Received: by 10.112.97.12 with HTTP; Wed, 21 May 2014 10:08:04 -0700 (PDT)
In-Reply-To: <4711428.mIyGVVfVCn@tjmaciei-mobl4>
X-Original-Sender: farid.mehrabi@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of farid.mehrabi@gmail.com designates 2a00:1450:4010:c03::22a as
 permitted sender) smtp.mail=farid.mehrabi@gmail.com;       dkim=pass
 header.i=@gmail.com;       dmarc=pass (p=NONE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:10731
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/10731>

--001a113457dc63796a04f9ec0b4b
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

2014-05-21 19:45 GMT+04:30 Thiago Macieira <thiago@macieira.org>:

> Em qua 21 maio 2014, =C3=A0s 19:09:13, Farid Mehrabi escreveu:
> > ///////////////////////////Public.h//////////////////////////
> > typename Private;
> > void PublicFoo(Private&);
> >
> > //////////////////////////Private.h//////////////////////////
> > typedef XXXX Private;
> >
> > //////////////////////////Private.c//////////////////////////
> > /* Output -> Private.a, Private.lib , Private.so, Private.dll*/
> > #include <Public.h>
> > #include <Private.h>
>
> As long as that #include <Public.h> is present, you're still matching my
> request.
>
> > void PublicFoo(Private& ref)
> > {
> >       //blah,blah....
> > };
> >
> > ///////////////////////////User.c/////////////////////////////
> > #include <Public.h>
> > void  UserFoo(Private* ptr){PublicFoo(*ptr);};
>
> The above translates to:
>
> =3D=3D=3D private.cpp =3D=3D=3D
> typename Private;
> typedef XXXX Private;
> void PublicFoo(Private &ref) {}
>
> =3D=3D=3D public.cpp =3D=3D=3D
> typename Private;
> void PublicFoo(Private &);
> void UserFoo(Private *ptr) { PublicFoo(*ptr); }
> =3D=3D=3D=3D
>
> The above is could work.
>
> However, if you remove the first line in the private source and make it
> like
> so:
>
> =3D=3D=3D private.cpp =3D=3D=3D
> typedef XXXX Private;
> void PublicFoo(Private &ref) {}
>
> =3D=3D=3D=3D
>
> Then the program is ill-formed.
>
>
That matters only If the layout of pointer is type-dependent. Name mangling
issues can be fixed by some sort of regexp magic in the linker design to be
able to match correct definitions. That sort of trick is already used in
embedded industry to enable optional definition of e.g interrupt handler
functions; if the user provides a definition for certain functions, the
default definition is rejected.

--=20
how am I supposed to end the twisted road of  your hair in the dark night??
unless the candle of your face does turn a lamp up on my way!!!

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--001a113457dc63796a04f9ec0b4b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"rtl"><br><div class=3D"gmail_extra"><div style=3D"text-align:le=
ft"><br></div><div style=3D"text-align:left"><br></div><div class=3D"gmail_=
quote"><div dir=3D"ltr">2014-05-21 19:45 GMT+04:30 Thiago Macieira <span di=
r=3D"ltr">&lt;<a href=3D"mailto:thiago@macieira.org" target=3D"_blank">thia=
go@macieira.org</a>&gt;</span>:</div>

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div style=3D"text-align:left">Em qua 21 mai=
o 2014, =C3=A0s 19:09:13, Farid Mehrabi escreveu:</div>
<div class=3D""><div style=3D"text-align:left">&gt; ///////////////////////=
////Public.h//////////////////////////</div><div style=3D"text-align:left">=
&gt; typename Private;</div><div style=3D"text-align:left">&gt; void Public=
Foo(Private&amp;);</div>

<div style=3D"text-align:left">&gt;</div><div style=3D"text-align:left">&gt=
; //////////////////////////Private.h//////////////////////////</div><div s=
tyle=3D"text-align:left">&gt; typedef XXXX Private;</div><div style=3D"text=
-align:left">

&gt;</div><div style=3D"text-align:left">&gt; //////////////////////////Pri=
vate.c//////////////////////////</div><div style=3D"text-align:left">&gt; /=
* Output -&gt; Private.a, Private.lib , Private.so, Private.dll*/</div><div=
 style=3D"text-align:left">

&gt; #include &lt;Public.h&gt;</div><div style=3D"text-align:left">&gt; #in=
clude &lt;Private.h&gt;</div>
<div style=3D"text-align:left"><br></div>
</div><div style=3D"text-align:left">As long as that #include &lt;Public.h&=
gt; is present, you&#39;re still matching my</div><div style=3D"text-align:=
left">request.</div>
<div class=3D""><div style=3D"text-align:left"><br></div><div style=3D"text=
-align:left">&gt; void PublicFoo(Private&amp; ref)</div><div style=3D"text-=
align:left">&gt; {</div><div style=3D"text-align:left">&gt; =C2=A0 =C2=A0 =
=C2=A0 //blah,blah....</div>

<div style=3D"text-align:left">&gt; };</div><div style=3D"text-align:left">=
&gt;</div><div style=3D"text-align:left">&gt; ///////////////////////////Us=
er.c/////////////////////////////</div><div style=3D"text-align:left">&gt; =
#include &lt;Public.h&gt;</div>

<div style=3D"text-align:left">&gt; void =C2=A0UserFoo(Private* ptr){Public=
Foo(*ptr);};</div>
<div style=3D"text-align:left"><br></div>
</div><div style=3D"text-align:left">The above translates to:</div>
<div style=3D"text-align:left"><br></div><div style=3D"text-align:left">=3D=
=3D=3D private.cpp =3D=3D=3D</div><div style=3D"text-align:left">typename P=
rivate;</div><div style=3D"text-align:left">typedef XXXX Private;</div><div=
 style=3D"text-align:left">

void PublicFoo(Private &amp;ref) {}</div>
<div style=3D"text-align:left"><br></div><div style=3D"text-align:left">=3D=
=3D=3D public.cpp =3D=3D=3D</div><div style=3D"text-align:left">typename Pr=
ivate;</div><div style=3D"text-align:left">void PublicFoo(Private &amp;);</=
div><div style=3D"text-align:left">

void UserFoo(Private *ptr) { PublicFoo(*ptr); }</div><div style=3D"text-ali=
gn:left">=3D=3D=3D=3D</div>
<div style=3D"text-align:left"><br></div><div style=3D"text-align:left">The=
 above is could work.</div>
<div style=3D"text-align:left"><br></div><div style=3D"text-align:left">How=
ever, if you remove the first line in the private source and make it like</=
div><div style=3D"text-align:left">so:</div>
<div style=3D"text-align:left"><br></div><div style=3D"text-align:left">=3D=
=3D=3D private.cpp =3D=3D=3D</div><div style=3D"text-align:left">typedef XX=
XX Private;</div><div style=3D"text-align:left">void PublicFoo(Private &amp=
;ref) {}</div>
<div style=3D"text-align:left"><br></div><div style=3D"text-align:left">=3D=
=3D=3D=3D</div>
<div style=3D"text-align:left"><br></div><div style=3D"text-align:left">The=
n the program is ill-formed.</div>
<div class=3D"HOEnZb"><div class=3D"h5"><div style=3D"text-align:left"><br>=
</div></div></div></blockquote><div><br></div><div style=3D"text-align:left=
" dir=3D"ltr">That matters only If the layout of pointer is type-dependent.=
 Name mangling issues can be fixed by some sort of regexp magic in the link=
er design to be able to match correct definitions. That sort of trick is al=
ready used in embedded industry to enable optional definition of e.g interr=
upt handler functions; if the user provides a definition for certain functi=
ons, the default definition is rejected.</div>

<div>=C2=A0</div></div><div style=3D"text-align:left">--=C2=A0</div><div di=
r=3D"ltr">how am I supposed to end the twisted road of=C2=A0 your hair in t=
he dark night??<br>unless the candle of your face does turn a lamp up on my=
 way!!!<br></div>


</div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a113457dc63796a04f9ec0b4b--

.
