Question

I have seen it used twice already in different libraries as an abbreviation, but I can't wrap my head around what it should mean.

For example here:

static int reformat_string(void * ctx, const unsigned char * stringVal,  
                       size_t stringLen)  
{  
    yajl_gen g = (yajl_gen) ctx;  
    return yajl_gen_status_ok == yajl_gen_string(g, stringVal, stringLen);  
}  

As far as I can tell, it is usually used for structs.

Était-ce utile?

La solution

It typically stands for "context". Usually this is some structure that gets passed around to functions in a library, used to maintain state (i.e., the context of the function call).

It's a preferable alternative to using global variables.

Autres conseils

By acronymsandslang.com It means "context". But You can look for other CTX meaning there

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top