Welcome to %s forums

BrainModular Users Forum

Login Register

array size & PC/MAC question

Create your own modules in C++
Post Reply
23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 10 Nov 2015, 00:03

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?

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 17 Dec 2015, 20:28

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 ) ;

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 18 Dec 2015, 23:59

ok think i get the idea, thx!

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests