Thread overview
stdarg format conflict
Sep 03, 2004
Ivan Senji
Sep 03, 2004
Ivan Senji
Sep 03, 2004
Sean Kelly
Sep 06, 2004
Arcane Jill
Sep 06, 2004
antiAlias
September 03, 2004
Can't use both
std.stdio; and
std.stdarg;

Also as of 0.101 can't use std.stream with std.stdarg, because it also imports std.format;

because of the conflicting va_args's reported by linker.

Should format.d maybe private import std.stdarg? Would
that help?


I'm begining to dislike writef[ln] very much, all it has given me is
trouble. I managed to remove all writefln's from my project
and repleace them with the horrible printf, but i can't remove
streams and i need stdarg.







September 03, 2004
Sorry here is the example:

<CODE>
import std.stdio;
import std.stdarg;

void foo(int x, ...)
{
 printf("%d arguments\n", _arguments.length);
 for (int i = 0; i < _arguments.length; i++)
 {   _arguments[i].print();

 if (_arguments[i] == typeid(int))
 {
  int j = va_arg!(int)(_argptr);
  printf("\t%d\n", j);
 }
 else if (_arguments[i] == typeid(long))
 {
  long j = va_arg!(long)(_argptr);
  printf("\t%lld\n", j);
 }
 else
  assert(0);
 }
}

int main(char[][] args)
{
 writefln("Hello",4,6);
 return 1;
}
</CODE>

the woraround is not to use stdarg but i like it better than:
    int j = *cast(int *)_argptr;
		    _argptr += int.sizeof;



September 03, 2004
In article <ch9q4s$1k9m$1@digitaldaemon.com>, Ivan Senji says...
>
>Can't use both
>std.stdio; and
>std.stdarg;
>
>Also as of 0.101 can't use std.stream with std.stdarg, because it also imports std.format;
>
>because of the conflicting va_args's reported by linker.
>
>Should format.d maybe private import std.stdarg? Would
>that help?

I don't know that it will help.  This is a bug that I reported a while back, but it has not been fixed yet.  The easiest way to fix it is to explicitly compile format.d and perhaps stdarg.d into your application.


Sean


September 06, 2004
In article <ch9q4s$1k9m$1@digitaldaemon.com>, Ivan Senji says...

>Should format.d maybe private import std.stdarg?

Yes.

Moreover, /all/ imports of parts of Phobos should be private, unless specifically documented otherwise, and even then only if there's a very good reason for it.

Jill


September 06, 2004
Absolutely; and import should /default/ to private ...

"Arcane Jill" <Arcane_member@pathlink.com> wrote in message
news:chh39k$149h$1@digitaldaemon.com...
In article <ch9q4s$1k9m$1@digitaldaemon.com>, Ivan Senji says...

>Should format.d maybe private import std.stdarg?

Yes.

Moreover, /all/ imports of parts of Phobos should be private, unless specifically documented otherwise, and even then only if there's a very good reason for it.

Jill