Should dmd have given me a warning at least?
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Sep 12 21:47:51 PDT 2014
On 09/12/2014 05:52 PM, WhatMeWorry wrote:
> Isn't this a contradiction. The documentation says "glGetString
> returns a pointer to a static string..."
They are talking about a C string, which is normally a 'char*' (their
API returns 'GLubyte*' but it doesn't matter here).
> But further on down it
> then says "If an error is generated, glGetString returns 0."
> This is the numeric value zero, right?
>
> So how can glGetString() return both a string and a zero?
In C (and C++ and D) numerical 0 is a placeholder for the null pointer
value, whatever the actual null pointer value for that platform may be.
(As far as I know, the actual null pointer value of all modern systems
is also 0.)
So, both are pointers: a C string is represented as a char* and 0 is the
null pointer value. No contradiction there.
I hope others with GL experience will answer your question.
> Btw, your book is excellent, Ali.
Thank you very much. :)
Ali
More information about the Digitalmars-d-learn
mailing list