Author Topic: [SOLVED] Q_strcmp, Q_stricmp, etc...  (Read 6933 times)

Bomb

  • Guest
[SOLVED] Q_strcmp, Q_stricmp, etc...
« 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?
« Last Edit: July 04, 2008, 03:16:07 pm by Bomb »

kevlarman

  • Posts: 2737
  • Turrets: +291/-295
Re: Q_strcmp, Q_stricmp, etc...
« Reply #1 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)
Quote from: Asvarox link=topic=8622.msg169333#msg169333
Ok let's plan it out. Asva, you are nub, go sit on rets, I will build, you two go feed like hell, you go pwn their asses, and everyone else camp in the hallway, roger?
the dretch bites.
-----
|..d| #
|.@.-##
-----

Bomb

  • Guest
Re: Q_strcmp, Q_stricmp, etc...
« Reply #2 on: July 04, 2008, 04:36:59 am »
I'm sorry, but could you rephrase that? So a non-pro like myself can understand?
« Last Edit: July 04, 2008, 04:39:21 am by Bomb »

Lakitu7

  • Tremulous Developers
  • *
  • Posts: 1002
  • Turrets: +120/-73
Re: Q_strcmp, Q_stricmp, etc...
« Reply #3 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.

Undeference

  • Tremulous Developers
  • *
  • Posts: 1254
  • Turrets: +122/-45
Re: Q_strcmp, Q_stricmp, etc...
« Reply #4 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.
Need help? Ask intelligently. Please share solutions you find.

Thats what we need, helpful players, not more powerful admins.

benmachine

  • Posts: 915
  • Turrets: +99/-76
    • ben's machinery
Re: Q_strcmp, Q_stricmp, etc...
« Reply #5 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.
benmachine

Bomb

  • Guest
Re: Q_strcmp, Q_stricmp, etc...
« Reply #6 on: July 04, 2008, 02:59:38 pm »
Ahhh. Well, I googled "c strcmp" and it was very helpful. Thanks all.

Bissig

  • Posts: 1309
  • Turrets: +103/-131
Re: [SOLVED] Q_strcmp, Q_stricmp, etc...
« Reply #7 on: July 04, 2008, 08:02:15 pm »
They are all string manipulating/comparing functions.