Am 29.08.2012 22:43, schrieb Leigh Johnston:
> On 29/08/2012 21:33, Jens Gustedt wrote:
>> Am 29.08.2012 21:09, schrieb Leigh Johnston:
>>> On 29/08/2012 19:49, Jens Gustedt wrote:
>>>> Am 29.08.2012 20:16, schrieb Leigh Johnston:
>>>>> this has not changed from C to C++. The lack of
>>>>> implicit conversion *from* void* does not change the utility of void*.
>>>>
>>>> For C programmers it does make "void*" useless.
>>>
>>> So malloc is useless?
>>
>> not in C, where implicit conversion from "void*" works without
>> problems
>
> Ergo void* is not useless in C.
Where did you read that? I didn't say that. I am just, almost
desperately seeking someone who wants to present me with a real use
case in C++.
It has a lot of good use cases in C. It would lose most of its use in
C, if it wouldn't implicitly convert to any other pointer to object
type.
>> or where you refering to C++? using malloc? doesn't that give you
>> objects for which the constructor isn't called 
>
> I never use malloc in a C++ program.
see
>> you don't answer my question, still no example for a real use case in
>> C++, could you be more concrete?
>
> Example: a pointer to an object associated with in an item in a GUI list
> box widget. In the GUI library I am currently creating the list box
> widget is actually a template however the item data type defaults to
> void* as both a convenience and a way to reduce template bloat; however
> lots of GUI libraries solely use void* for such things (e.g. Microsoft
> Win32 API).
Then they are no good C++. These things can be done in C++ without any
loss of performance and with much more type safety by using templates,
inheritance, all that machinery.
So you gave me an example where "void*" encourages bad design, is
that?
My claim would be that *if* you want to play such "dirty tricks"
create a proper interface and then program the beast itself in C.
> Another example: an object pointer passed to /pthread_create/.
That doesn't count, pthread_create (or better the new and shiny
thrd_create) are C interfaces. They are designed as such. That is not
a proper use case for C++.
Jens