digitalmars.D - (linux bug?) why is it that a function must return a value or it seg faults?
- clayasaurus <clayasaurus_member pathlink.com> Jul 19 2004
- Ant <Ant_member pathlink.com> Jul 19 2004
- clayasaurus <clayasaurus_member pathlink.com> Jul 19 2004
- clayasaurus <clayasaurus_member pathlink.com> Jul 19 2004
- clayasaurus <clayasaurus_member pathlink.com> Jul 19 2004
- clayasaurus <clayasaurus_member pathlink.com> Jul 19 2004
- clayasaurus <clayasaurus_member pathlink.com> Jul 19 2004
- clayasaurus <clayasaurus_member pathlink.com> Jul 19 2004
- "Walter" <newshound digitalmars.com> Jul 23 2004
- Ant <duitoolkit yahoo.ca> Jul 23 2004
Hello. I'm working on a project with multiple files and all. Here is the code
void logf(...) // this will cause a seg fault
{
// do logging stuff
}
bit logf(...) // this will work just fine
{
// do logging stuff
return true;
}
I'm wondering why is it that when I use (...) for an argument, I must return a
value or else it segfaults?
Jul 19 2004
In article <cdgn2l$fk1$1 digitaldaemon.com>, clayasaurus says...Hello. I'm working on a project with multiple files and all. Here is the code void logf(...) // this will cause a seg fault { // do logging stuff } bit logf(...) // this will work just fine { // do logging stuff return true; } I'm wondering why is it that when I use (...) for an argument, I must return a value or else it segfaults?
oh! that's why! I experienced that and just remove the (...) parameter, changing the API of the thing of course. This is on DUI MessageDialog and nobody notice it. :( Ant
Jul 19 2004
argh! wtf?! Ok, now I can use void logf(...) fine, however, if i don't pass at least 2 parameters it causes it to crash. :-|
Jul 19 2004
but if i pass two or more arguments into writef than it doesn't crash! help! these seg-faults are eating away at my sssanityyz ahh!
Jul 19 2004
and sometimes I have to pass at least 3 arguments or it causes it to crash.
Jul 19 2004
i found it that it doesn't even seg fault inside the function. just the act of passing less than two or three arguments causes it to seg fault.
Jul 19 2004
a temporary solution is to pass 2 dummy arguments for my function like
void logf(int dummy, int dummy2, ...)
{
char[] message = stamp(std.utf.toUTF8(formatstring(_arguments, _argptr)));
gLogFile.writeString(message);
}
and it works. however it seems unnecessary and it's ugly.
I hope there's a better way.
Jul 19 2004
Ok, here is something different but I think it is related some how. When I use writef it crashes, when i use printf it doesn't. This must be a bug, right? (see attachment)
Jul 19 2004
"clayasaurus" <clayasaurus_member pathlink.com> wrote in message news:cdgrdn$hig$1 digitaldaemon.com...Ok, here is something different but I think it is related some how. When I
writef it crashes, when i use printf it doesn't. This must be a bug, right? (see attachment)
I can't reproduce the problem with your example.
Jul 23 2004
On Fri, 23 Jul 2004 17:43:20 -0700, Walter wrote:"clayasaurus" <clayasaurus_member pathlink.com> wrote in message news:cdgrdn$hig$1 digitaldaemon.com...Ok, here is something different but I think it is related some how. When I
writef it crashes, when i use printf it doesn't. This must be a bug, right? (see attachment)
I can't reproduce the problem with your example.
I can't either but I had the same problem, I'll post it if I can reduce it to 10 lines Ant
Jul 23 2004









Ant <Ant_member pathlink.com> 