C Newbie Question: Explain (textBuffer *) in buf = (textBuffer
*)XtMalloc(sizeof(textBuffer));
Randy Kramer
rhkramer at gmail.com
Sat Nov 17 05:00:25 CET 2007
Can anybody help me understand the following statement, or more specifically,
the "(textBuffer *)" part:
buf = (textBuffer *)XtMalloc(sizeof(textBuffer));
Just as a guess, I'm guessing that it does something like make buf a pointer
to a thingie of type textBuffer, and, in fact the pointer points to the
address of the memory returned by XtMalloc?
Hmm, can I state that more clearly (or should I wait until confirmation that
it is somewhere close to correct)? I'll give it a shot: the statement makes
buf a pointer to a portion of memory (returned by XtMalloc) of type
textBuffer.
(By George, I might have got it (or, I might be off by a mile).)
Aside: At the moment, I don't care too much about the XtMalloc function--I
assume it is allocating memory, is a function related to X, and if I wanted
the details would have to look "over there" somewhere (like in Xlib, Motif,
Lesstif, or whatever).
Thanks,
Randy Kramer
More information about the Develop
mailing list