キモブロ

Please spy check please, Fucking retard

SourceMODに組み込まれているSourcePawn言語のPreprocessorには、Stringize Operatorがない

Stringize Operator とは、C言語プリプロセッサでいうと #x のことである。ダブルクォートでかこって文字列化してくれる

#define hoge(x) #x

この例だとhoge(piyo)と書くと "piyo" になるやつ。


SourcePawnのPreprocessorの仕様を読むと、Stringize Operator はあると書いてあって、
具体的には #%x みたいな感じで出来ると書いてあるのだが、なぜか使えない。

↓以下SourcePawn言語ガイド

If an argument in the replacement text has a “#” immediately in front of it, the argument is converted to a packed string constant —meaning that double quotes are tagged at the beginning and the end. For example, if you have the definition:
#define log(%1) "ERR: " ... #%1 ... "\n"
then the expression log(test) will result in "ERR: " . . . "test" . . . "\n". The “#” operator is also called the “stringize” operator, as it converts arguments to (packed) strings.

http://www.compuphase.com/pawn/Pawn_Language_Guide.pdf

上記の通り仕様として存在してるんだけど、SourceMODに組み込まれてるSourcePawnでは実現できないっぽい。