Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

why we require void func( void ** ) ?

2 views
Skip to first unread message

Pallav singh

unread,
Oct 10, 2009, 1:48:23 PM10/10/09
to
Hi

why we require void func( void ** ) ?

Thanks
Pallav Singh
--
comp.lang.c.moderated - moderation address: cl...@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.

Dag-Erling Smørgrav

unread,
Oct 10, 2009, 4:07:18 PM10/10/09
to
Pallav singh <singh....@gmail.com> writes:
> why we require void func( void ** ) ?

Did you think you'd get a different answer here than on comp.std.c?

Your question doesn't make sense; you need to provide some context.

DES
--
Dag-Erling Smørgrav - d...@des.no

Kenneth Brody

unread,
Oct 12, 2009, 10:05:56 PM10/12/09
to
Pallav singh wrote:
> Hi
>
> why we require void func( void ** ) ?

I maintain an application consisting of several hundred thousand lines of
code, and the construct "void func( void ** )" doesn't appear once.

Now, as to why _you_ may require it, I have no idea. Perhaps if you were to
include some context to your question, we might be able to help.

--
Kenneth Brody

Andrei Voropaev

unread,
Oct 13, 2009, 2:42:53 PM10/13/09
to
On 2009-10-10, Pallav singh <singh....@gmail.com> wrote:
> why we require void func( void ** ) ?

Well, after all "pointer to pointer" is not the same as "pointer to
anything".

If you say

char array[1];
func(array);

then you'll get a warning from gcc (if you requested such warnings).

On the other hand declaration void func(void*) would eliminate this
warning. But if func then would try to save a pointer in the provided
space, then buffer overflow would happen.

--
Minds, like parachutes, function best when open

Johannes Schaub (litb)

unread,
Oct 15, 2009, 2:31:47 PM10/15/09
to
Pallav singh wrote:

> Hi
>
> why we require void func( void ** ) ?
>

It's a misunderstanding that if you generically want to pass T**, you would
need void**. No, you still can and should use void*, and within the function
cast to whatever type you need. A void** points to a void*, not to a T* of
any sort.

If you mean something else, please clarify.

0 new messages