{"action":"created","issue":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/2926","labels_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/2926/labels{/name}","comments_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/2926/comments","events_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/2926/events","html_url":"https://github.com/D-Programming-Language/phobos/pull/2926","id":55722610,"number":2926,"title":"Copy variadic arguments to buffer to avoid horrific varargs hacks","user":{"login":"yebblies","id":580100,"avatar_url":"https://avatars.githubusercontent.com/u/580100?v=3","gravatar_id":"","url":"https://api.github.com/users/yebblies","html_url":"https://github.com/yebblies","followers_url":"https://api.github.com/users/yebblies/followers","following_url":"https://api.github.com/users/yebblies/following{/other_user}","gists_url":"https://api.github.com/users/yebblies/gists{/gist_id}","starred_url":"https://api.github.com/users/yebblies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yebblies/subscriptions","organizations_url":"https://api.github.com/users/yebblies/orgs","repos_url":"https://api.github.com/users/yebblies/repos","events_url":"https://api.github.com/users/yebblies/events{/privacy}","received_events_url":"https://api.github.com/users/yebblies/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/D-Programming-Language/phobos/labels/pending%20autotester","name":"pending autotester","color":"bfdadc"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":18,"created_at":"2015-01-28T07:17:59Z","updated_at":"2015-02-06T09:02:00Z","closed_at":"2015-01-28T09:27:03Z","pull_request":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/2926","html_url":"https://github.com/D-Programming-Language/phobos/pull/2926","diff_url":"https://github.com/D-Programming-Language/phobos/pull/2926.diff","patch_url":"https://github.com/D-Programming-Language/phobos/pull/2926.patch"},"body":"The current implementation of `doFormat` forges a `va_list` so it can recurse to print out array and AA members.  This was straightforward on X86, but the complexity of X86_64 varargs abis means that it has to jump through some rather horrific and non-portable hoops to get this to work.\r\n\r\nThis replacement implementation instead copies all variadic arguments to a buffer, being careful to preserve required alignment.  This allows the arguments to be iterated through with a simple pointer on all platforms.\r\n\r\nThe copy to the buffer naturally comes with a slight performance penalty, but given the simplification of the code, the improved portability, and the fact that `doFormat`'s only remaining caller is `std.stream`, I think it's worth that cost.\r\n\r\n@andralex @ibuclaw "},"comment":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/comments/73206010","html_url":"https://github.com/D-Programming-Language/phobos/pull/2926#issuecomment-73206010","issue_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/2926","id":73206010,"user":{"login":"ibuclaw","id":397929,"avatar_url":"https://avatars.githubusercontent.com/u/397929?v=3","gravatar_id":"","url":"https://api.github.com/users/ibuclaw","html_url":"https://github.com/ibuclaw","followers_url":"https://api.github.com/users/ibuclaw/followers","following_url":"https://api.github.com/users/ibuclaw/following{/other_user}","gists_url":"https://api.github.com/users/ibuclaw/gists{/gist_id}","starred_url":"https://api.github.com/users/ibuclaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibuclaw/subscriptions","organizations_url":"https://api.github.com/users/ibuclaw/orgs","repos_url":"https://api.github.com/users/ibuclaw/repos","events_url":"https://api.github.com/users/ibuclaw/events{/privacy}","received_events_url":"https://api.github.com/users/ibuclaw/received_events","type":"User","site_admin":false},"created_at":"2015-02-06T09:02:00Z","updated_at":"2015-02-06T09:02:00Z","body":"Mangled and passed as C arrays.  Otherwise functions such as vaprintf will not work.  Current workaround is to rewrite the va parameters as ref, but the compiler only knows how to deal with gcc.builtins and core.stdc packages.\nThis is really only to deal with va_list, and not static arrays in general."}}