Could use some help with variable length argument lists

Marc Ramirez marc.ramirez at bluecirclesoft.com
Tue Feb 10 15:06:15 PST 2004


On Tue, Feb 10, 2004 at 03:37:00PM -0500, Jeremy Faulkner wrote:
> 
> 
> va_start says that the last required variable is "message".
> 
> You can't use ap because it's not in the list of variables when you 
> called the function.

ap doesn't represent a parameter, it represents the list. C/C++ have
no way of knowing how many parameters were passed in.  The information
in "message" tells the function how many parameters are in the list.

> _log(1, "Log test");
> 		  ^ There's nothing there to be "ap"
> 
> So it "Segmentation fault (core dumped)"'s
> 
> _log(1, "Log test", NULL);

If that were true, then

	printf("Hello, world!");

could never work.

Marc.

> -- 
> Jeremy Faulkner				http://www.gldis.ca
> _______________________________________________
> freebsd-chat at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-chat
> To unsubscribe, send any mail to "freebsd-chat-unsubscribe at freebsd.org"

-- 
Marc Ramirez
Blue Circle Software Corporation
513-688-1070 (main)
513-382-1270 (direct)
http://www.bluecirclesoft.com
http://www.mrami.com (personal)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-chat/attachments/20040210/0013e331/attachment.bin


More information about the freebsd-chat mailing list