FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

std.stdarg not available?

 
Post new topic   Reply to topic     Forum Index -> Ares
View previous topic :: View next topic  
Author Message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Tue Dec 13, 2005 4:24 am    Post subject: std.stdarg not available? Reply with quote

I am attempting to compile the recent Mango tree with -version=Ares on win32. The process interrupted because Mango keeps trying to import "std.stdarg" into a few files.

I had a look in Ares. Obviously, std.stdarg is not there, although std.c.stdarg exists. Phobos has both, one for argument lists with extern(D) linkage (std.stdarg) and the other one for variable argument lists with extern(C) linkage.

Does Ares not include std.stdarg for a reason? For now, I can workaround the problem easily enough by manually adding std.stdarg.

Thanks.

-JJR
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Tue Dec 13, 2005 11:31 am    Post subject: Reply with quote

Hrm, I suppose I should add std.stdarg. I'd overlooked it.
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Tue Dec 13, 2005 11:41 am    Post subject: Reply with quote

Odd. Here is the code in std.stdarg:
Code:
template va_arg(T)
{
    T va_arg(inout va_list _argptr)
    {
   T arg = *cast(T*)_argptr;
   _argptr = _argptr + ((T.sizeof + int.sizeof - 1) & ~(int.sizeof - 1));
   return arg;
    }
}

and here is the same function in std.c.stdarg:
Code:
template va_arg(T)
{
    T va_arg(inout va_list ap)
    {
   T arg = *cast(T*)ap;
   ap = cast(va_list)(cast(void*)ap + ((T.sizeof + int.sizeof - 1) & ~(int.sizeof - 1)));
   return arg;
    }
}

Perhaps it's because I haven't had my coffee yet, but I can't see any difference. What am I missing? Note that the type of va_list is void* in both cases.
Back to top
View user's profile Send private message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Tue Dec 13, 2005 2:46 pm    Post subject: Reply with quote

I really don't know. I guess _argptr and ap are pretty much the same? I don't get why va_list is cast to (void*) and then back to (va_list) again in std.c.stdarg.

You're right it does look pretty much the same. Razz

Nonetheless, Walter calls one for extern(C) and the other for extern(D).

-JJR
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Tue Dec 13, 2005 3:48 pm    Post subject: Reply with quote

Drat ~ forgot to mention this to you, Sean.

Is argptr a void* on all platforms? Is GDC like this for the C version?
Back to top
View user's profile Send private message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Tue Dec 13, 2005 7:04 pm    Post subject: Reply with quote

So what is going to be done?

Since std.stdarg and std.c.stdarg are pretty much the same, I guess we only need one of these then? std.c.stdarg has a little extra, so will that one stay?

Kris, are you going to change Mango for the Ares compile then?

Thanks,

John
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Tue Dec 13, 2005 7:31 pm    Post subject: Reply with quote

Let's wait to see what Sean wants to do?

My preference would be to keep the std.stdarg and drop the std.c version, assuming they perform the same function. The rationale is that there needs to be at least a D version.
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Wed Dec 14, 2005 2:07 am    Post subject: Reply with quote

I haven't decided what to do about this yet. std.c.stdarg is required by the C99 spec, so I'd like to keep it, but it does seem appropriate that there be a D version as well. I may add a std.stdarg file that just publicly imports std.c.stdarg for now.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Ares All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group