Re: The meaning of the word generic



Albert wrote:

What do people mean by generic pointers

A pointer to an area of memory (if generic data pointer, rather than function pointer) that may be used for different purposes.


Why is a pointer to void generic

Because it doesn't point to a specific type of data, but can be converted to a pointer to any data type.


Why would someone need pointers to void?

One example is a pointer to the memory returned by malloc(). malloc() doesn't know or care what the memory will be used for. It returns a generic pointer that has type void*. Another example is the array argument passed to qsort().


--
Thad
.



Relevant Pages

  • Re: Differance between Array and Pointers
    ... pointer - an integer that holds the address of some data type ... Address - a value which indicates a location in memory. ... Pointer - a location in memory which contains an address. ... Array - one of many data types which can reside in memory. ...
    (comp.arch.embedded)
  • Re: Garbage collection
    ... For example, it's perfectly legal to take a pointer object, break its ... memory that refers to the referenced block of memory, ... They manage their memory themselves *because* they care about it. ... other language feature you care to name: ...
    (comp.lang.c)
  • SOLVED - help reading fortran generated binary data (LONG)
    ... problem, as some of you expected, is that my read pointer was "off" by one ... placed the read pointer in the proper position to correctly continue ... but are organized into 130 byte chunks. ... number of that data type to read. ...
    (comp.lang.tcl)
  • Re: A malloc question, part 2
    ... Using a pointer to data type X and effectively assigning to it data type Y ... If I can store SomeStruct in p and UserStruct ... aribtrary_integer) is not guaranteed to have such alignment. ...
    (comp.lang.c)
  • Re: Fortran 2003: Procedure pointers
    ... Also note that this has an implicit interface. ... As procedure pointers can be thought as "kind of dummy procedures". ... only difference is that they have a pointer attribute and their reference ... > integer data type, ...
    (comp.lang.fortran)