开发者

how can i pass the constant value made by the keyword #define to a method as a parameter?

开发者 https://www.devze.com 2023-02-07 17:10 出处:网络
I have defined a constant in my some file and added in file where i wanna use it as shown below. #define myMapID 1

I have defined a constant in my some file and added in file where i wanna use it as shown below.


#define myMapID 1

But the problem is when i passed开发者_如何学Python the value to a method as a parameter, the compiler gives warning, and yes it must do but how can i avoid warnings ?


-(void) methodName :(int) mapId
{
//printID
}

[self methodName :myMapID];


Just use a (global) static/constant int, much clearer than #define and won't give a warning.


Odd that it would give you a warning on that. try:

#define myMapID (int) 1

maybe?

0

精彩评论

暂无评论...
验证码 换一张
取 消