🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c.moderated
Article #2545

Re: (double **) void **

#2545
From: William Kaufman
Date: Mon, 08 Apr 1996 16:07
33 lines
1928 bytes
In article <4k60po$aic@solutions.solon.com> thomas@eel.rdc.toshiba.co.jp (Arun M. Thomas) writes:
] 
] Greetings.  
] 
] I'm trying to make a function to generate 2D arrays.  One of the arguments to
] my function is the size of the datatype to be stored as one element in the 
] array.  The function is listed below, and I'd like to know if it is legal.
] I'm afraid it isn't (I've commented at the lines where I'm doubtful.)  

    From the comp.lang.c FAQ:

4.9:	Can I use a void ** pointer to pass a generic pointer to a
	function by reference?

A:	Not portably.  There is no generic pointer-to-pointer type in C.
	void * acts as a generic pointer only because conversions are
	applied automatically when other pointer types are assigned to
	and from void *'s; these conversions cannot be performed (the
	correct underlying pointer type is not known) if an attempt is
	made to indirect upon a void ** value which points at something
	other than a void *.

]     m = (void **) calloc(len_d1, sizeof(void *));        /* Is (void **) a   */
]     if(!m) nrerror("allocation failure 1 in matrix()");  /*  valid date type?*/

    (void **) _is_ a valid data type, but it isn't worth much unless you
actually want an array of (void *)s and will use it as such.


                                           -- Bill K.

Bill Kaufman,          | "People look better under arrest,...it gives you
wkaufman@us.oracle.com |  an aggressive fashion look."  -- John Waters
Technical Details
Message-ID: <4kbdk3$e7l@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4k60po$aic@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: wkaufman@us.oracle.com (William Kaufman)
Newsgroups: comp.lang.c.moderated
Subject: Re: (double **) void **
Date: 8 Apr 1996 11:07:31 -0500
Organization: Oracle Corporation, Redwood Shores CA
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4kbdk3$e7l@solutions.solon.com>
References: <4k60po$aic@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com