Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Fucking pointers...

Name: Anonymous 2011-10-27 11:03

void prepare_lock (SDL_mutex ** global_lock)
{
SDL_mutex * lock = *global_lock;
if (lock == NULL)
{
// This works, obviously:
*global_lock = SDL_CreateMutex ();
// but this doesn't (so it's commented):
// lock = SDL_CreateMutex ();
}
}

When I run:

prepare_lock (&teh_lock);

How do I pointers?

Name: Anonymous 2011-10-27 11:05

point to my anus

Name: Anonymous 2011-10-27 11:08

>>1
FUCKING

Name: Anonymous 2011-10-27 11:16

>>1

void prepare_lock (SDL_mutex ** global_lock)
{
SDL_mutex * lock = *global_lock;
if (lock != NULL)
{
// This works, obviously:
*global_lock = SDL_CreateMutex ();
// now it does (so it's uncommented):
 lock = SDL_CreateMutex ();
}
}

Name: Anonymous 2011-10-27 11:16

>>4
you can thank me later

Name: Anonymous 2011-10-27 11:47

>>1
well fucktard you dont
if you dont know how to program

Name: Anonymous 2011-10-27 14:09

!= NULL
This really grinds my gears.

Name: Anonymous 2011-10-27 16:13

>>7
Why? NULL is implementation-defined. There is no guarantee it will be zero, hence the definition.

Name: Anonymous 2011-10-27 19:31

>>8
I,'ll bear that in mind if I've port to a faggit platform

Name: Anonymous 2011-10-27 19:57

>>8
EXPERT TROLLING

Name: Anonymous 2011-10-27 20:36

>>8
http://c-faq.com/null/ptrtest.html
But also...
http://c-faq.com/null/machexamp.html
Basically, unless you care about needing to run your code on some really odd system, for all practical purposes, all-bits-0 is the null pointer.

Name: Anonymous 2011-10-27 22:02

Even if NULL was 0 on all architectures you should use it, it's more readable.

Name: sage 2011-10-27 22:39

>>8

Comparing a pointer to zero is guaranteed to be a comparison against the null pointer. Assigning zero to a pointer is guaranteed to set the pointer to the null pointer. The null pointer binary representation might not be zero, but using zero as a basis for assigning/comparing to null is valid.

There's no need to compare to NULL in any circumstance.

Read the standard.

Name: Anonymous 2011-10-27 23:23

>>1

mailto: noko
mailto: noko
mailto: noko
mailto: noko
mailto: noko
mailto: noko
mailto: noko
mailto: noko
mailto: noko
mailto: noko
mailto: noko
mailto: noko
mailto: noko
mailto: noko
mailto: noko
mailto: noko
mailto: noko
mailto: noko
mailto: noko

Name: Anonymous 2011-10-27 23:43

>>14
autistic faggot

Name: Anonymous 2011-10-28 21:09


2011
still not realizing C allowed for (!lock) and (lock) to check if it's null or not

Name: Anonymous 2011-10-28 21:10

>>16
hey it's not a person's fault if he or she reads a terrible tutorial

Name: Anonymous 2011-10-28 22:45

>>17
sure it is said person oughta know better

Don't change these.
Name: Email:
Entire Thread Thread List