Raised This Month: $ Target: $400
 0% 

Compilation error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 04-02-2017 , 06:39   Compilation error
Reply With Quote #1

I guess there is a bug here:

PHP Code:
char inflictorname[MAXPLAYERS+1][256]; //global var
...
GetClientName(clientinflictorname[attacker], sizeof(inflictorname[attacker])); 
error 001: expected token: "]", but found "-identifier-"
This option works fine:
PHP Code:
GetClientName(clientinflictorname[attacker], 256); 
Btw, does sizeof(..) work in runtime?

Last edited by kadet.89; 04-02-2017 at 06:40.
kadet.89 is offline
Send a message via Skype™ to kadet.89
ejik03
AlliedModders Donor
Join Date: Feb 2009
Location: Moscow, Russia
Old 04-02-2017 , 07:36   Re: Compilation error
Reply With Quote #2

No, sizeof is a preprocessor directive (as well as #define and #pragma), so the value of "sizeof call" is being calculated on the compilation stage.

Try this:
Code:
GetClientName(client, inflictorname[attacker], sizeof(inflictorname[]));
ejik03 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:07.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode