Page 1 of 1

Posted: 10 Nov 2015, 00:03
by 23fx23
Im using this bit of code to make a listbox.

Code: Select all

		string COMMA_LIST[6] = { "aaa", "b", "ctest", "d", "e", "fff" };           //as a test
		NB_LIST_ITEMS = size_t _countof(COMMA_LIST);
it seems _countof is a VStudio or some specific compilers feature, any idea if would that still compile for mac without problems?

Posted: 17 Dec 2015, 20:28
by senso
I found that on the net.
so normally no problem

Code: Select all

#define _countof( _obj_ ) ( sizeof(_obj_) / (sizeof( typeof( _obj_[0] ))) )

NSString *s[2]={@"1", @"2"} ;
NSInteger iCount = _countof( s ) ;

Posted: 18 Dec 2015, 23:59
by 23fx23
ok think i get the idea, thx!