auto declaration & compiler warning
Stu
Stu_member at pathlink.com
Sun Mar 5 14:54:00 PST 2006
Don't know what the rest of the code's doing but this compiles ok for me
(DMD.148). Can you give us more of your code to get a small full example which
reproduces the error?
import std.stdio;
import std.socket;
void main()
{
Test t = new Test();
}
class Test
{
private InternetAddress ia;
private char[] hostName;
private void onRead()
{
auto InternetHost ih = new InternetHost();
if ( ih.getHostByAddr( ia.addr() ) )
{
//remember to delete this!!
hostName = ih.name.dup;
}
else
{
hostName = "unknown";
}
return true;
}
}
Stu
In article <dufjl2$11dh$1 at digitaldaemon.com>, akcom says...
>
>private void onRead()
>{
> ...
> auto InternetHost ih = new InternetHost();
> if ( ih.getHostByAddr( ia.addr() ) )
> {
> //remember to delete this!!
> hostName = ih.name.dup;
> }
> else
> {
> hostName = "unknown";
> }
> ...
> return true;
>}
>
>compiler gives the following: "warning - peer.d(342): function
>akp2p.peer.Peer.onRead no return at end of function"
>
>but when I remove the "auto" from the ih declaration, everything
>compiles as expected
More information about the Digitalmars-d-bugs
mailing list