Tremulous Forum

Mods => Modding Center => Topic started by: Bomb on July 04, 2008, 02:37:05 am

Title: [SOLVED] Q_strcmp, Q_stricmp, etc...
Post by: Bomb on July 04, 2008, 02:37:05 am
Hello everyone.

I've seen various functions in the SVN with names like Q_strcmp, Q_stricmp, Q_strncmp, Q_strncpy, etc. Can someone please tell me what these do and how to use them?
Title: Re: Q_strcmp, Q_stricmp, etc...
Post by: kevlarman on July 04, 2008, 03:46:59 am
exactly the same thing as their crt equivalents (in fact if building shared objects they ARE the crt versions)
Title: Re: Q_strcmp, Q_stricmp, etc...
Post by: Bomb on July 04, 2008, 04:36:59 am
I'm sorry, but could you rephrase that? So a non-pro like myself can understand?
Title: Re: Q_strcmp, Q_stricmp, etc...
Post by: Lakitu7 on July 04, 2008, 04:50:32 am
google "c strcmp" "c strncmp" etc.

Each of those (minus the Q_ prefix) is a function in C. The versions that the VMs use will behave the same way, so far as you're concerned.
Title: Re: Q_strcmp, Q_stricmp, etc...
Post by: Undeference on July 04, 2008, 07:43:10 am
(in fact if building shared objects they ARE the crt versions)
That is true of the functions in bg_lib.c (which have the same names as the CRT equivalent). It is not true of the Q_* functions.
Title: Re: Q_strcmp, Q_stricmp, etc...
Post by: benmachine on July 04, 2008, 09:59:56 am
Virtually all of them are defined in src/qcommon/q_shared.c, and most of them are actually pretty simple.

The Q_ is short for Quake, and ensures that the functions used are the ones in q_shared.c rather than in system libraries, for consistency.
Title: Re: Q_strcmp, Q_stricmp, etc...
Post by: Bomb on July 04, 2008, 02:59:38 pm
Ahhh. Well, I googled "c strcmp" and it was very helpful. Thanks all.
Title: Re: [SOLVED] Q_strcmp, Q_stricmp, etc...
Post by: Bissig on July 04, 2008, 08:02:15 pm
They are all string manipulating/comparing functions.