Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QuakeC: Variadic macros?

#1
So i couldnt help it and started playing with QuakeC a bit. Not to bad but now i am kinda stuck. Is there a way to define a variadic macro (function is hopeless i guess)? Reason i am asking is: I want to hook sprint which sadly is sometimes given multiple string parameters and id rather not resort to sed/replace-in-files just for testing. I am using fteqcc (would be using gmqcc but it threw errors at me trying to compile the codebase i am playing around with and i didnt feel like investigating) which seems to hapilly accept ... in macro definitions but then has no clue what __VA_ARGS__ is (it doesnt expand ... either which gave me slight hope i am just doing it wrong). Any clues?
Reply

#2
I have no problems with GMQCC, running Xonotic Git. Without it, you won't be able to get variadic arguments.

The Git repository should give you a working codebase & compiler:
http://dev.xonotic.org/projects/3/wiki/R...ory_Access

If you can get that working, there's an example of variadic arguments in the gamecode already, using sprintf:

#define printf(...) print(sprintf(__VA_ARGS__))
[Image: 230.jpg]
Reply

#3
Wow, very nice. Thanks alot. I didnt have to much hope this was going to work at all. I guess gmqcc here i come then!
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  What was easy for you in development? (Darkplaces and QuakeC programming) LegendGuard 2 3,060 08-08-2020, 05:25 PM
Last Post: LegendGuard
  [TUTORIAL] How to create a command - Xonotic QuakeC programming LegendGuard 3 3,703 07-25-2020, 06:24 PM
Last Post: LegendGuard
  Moving away from QuakeC Lyberta 11 10,845 07-17-2020, 07:36 AM
Last Post: LegendGuard
  [NEED HELP] [Commission] To update Jeff's Modpack - QuakeC programmer wanted breakfast 4 5,345 07-08-2020, 12:45 PM
Last Post: breakfast
  New QuakeC virtual machine Lyberta 5 7,647 07-14-2017, 04:01 PM
Last Post: poVoq
Brick A script engine written in QuakeC Melanosuchus 9 13,528 10-14-2014, 02:01 AM
Last Post: Melanosuchus
  QuakeC: if chains? WannabeUser 2 4,347 03-13-2014, 07:28 AM
Last Post: WannabeUser
  Learning QuakeC? phim 13 20,493 12-24-2013, 03:07 AM
Last Post: aa
  A question of getting started with Quakec timetopat 5 8,002 07-02-2012, 07:55 AM
Last Post: timetopat

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB original theme © iAndrew 2016, remixed by -z-