• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: XCode annoyance :-\
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XCode annoyance :-\


  • Subject: Re: XCode annoyance :-\
  • From: Clark Cox <email@hidden>
  • Date: Fri, 23 Jan 2004 15:47:31 -0500

You can't assign arrays like you're trying to do in C, C++ or
Objective-C. You can only use the {...} syntax to *initialize* them.



On Jan 23, 2004, at 14:48, David Cairns wrote:

> the array is defined in the class' header file as
>
> int array[4][4];
>
> -- david
>
> On Jan 23, 2004, at 12:15 PM, Oglesby, David (MN65) wrote:
>
>> How is array defined?
>>
>>> -----Original Message-----
>>> From: David Cairns [mailto:email@hidden]
>>> Sent: Friday, January 23, 2004 10:54 AM
>>> To: Oglesby, David (MN65)
>>> Subject: Re: XCode annoyance :-\
>>>
>>>
>>> i had that before, and i tried it without, and it didnt
>>> really seem to
>>> make any difference. good gravy this is making me so angry...
>>>
>>> -- david
>>>
>>> On Jan 23, 2004, at 11:06 AM, Oglesby, David (MN65) wrote:
>>>
>>>> No one's said this yet, so maybe I'm wrong. Don't you need extra
>>>> braces for a 2 dimensional array, or is that not what
>>>> you meant by 4x4 array?
>>>> array = {{1, 1, 0, 0},
>>>> {0, 1, 0, 0},
>>>> {0, 1, 0, 0},
>>>> {0, 0, 0, 0}};
>>>>
>>>> David
>>>>> -----Original Message-----
>>>>> From: David Cairns [mailto:email@hidden]
>>>>> Sent: Thursday, January 22, 2004 5:12 PM
>>>>> To: email@hidden
>>>>> Subject: XCode annoyance :-\
>>>>>
>>>>>
>>>>> hey all, im trying to make a little tetris clone (my first real run
>>>>> with openGL ;-))
>>>>>
>>>>> anyhoo, the project is sort of half-objC/half-c++ (my preferred
>>>>> language). i have plenty of experience using the two languages
>>>>> together and mixing them in source code, but this silly
>>>>> little problem
>>>>> is really annoying the heck out of me. Basically, I have a
>>>>> Piece class
>>>>> (C++ class), which contains a 4x4 array "array" of ints, specifying
>>>>> which spaces will contain blocks in my game.
>>>>>
>>>>> long story short ;-), this one constructor doesnt work
>>> and i have no
>>>>> idea why:
>>>>>
>>>>> // in header:
>>>>> Piece(int theType);
>>>>>
>>>>> // in .cpp:
>>>>> Piece::Piece(int theType)
>>>>> {
>>>>> myShape = theType;
>>>>> myColor = theType;
>>>>>
>>>>> switch (theType)
>>>>> {
>>>>> case kLShapeLeft:
>>>>> array = {1, 1, 0, 0,
>>>>> 0, 1, 0, 0,
>>>>> 0, 1, 0, 0,
>>>>> 0, 0, 0, 0}; // Piece.cpp:24: error: parse
>>>>> error before `{' token
>>>>>
>>>>> break;
>>>>>
>>>>> case kLShapeRight: // Piece.cpp:30: error: case label
>>>>> `kLShapeRight'
>>>>> not within a switch statement
>>>>>
>>>>> array = {1, 1, 0, 0,
>>>>> 1, 0, 0, 0,
>>>>> 1, 0, 0, 0,
>>>>> 0, 0, 0, 0}; // Piece.cpp:31: error: parse
>>>>> error before `{' token
>>>>>
>>>>> break; // Piece.cpp:28: error: break statement not
>>>>> within loop or
>>>>> switch
>>>>>
>>>>>
>>>>> case kBox:
>>>>> array = {1, 1, 0, 0,
>>>>> 1, 1, 0, 0,
>>>>> 0, 0, 0, 0,
>>>>> 0, 0, 0, 0};
>>>>> break;
>>>>>
>>>>> case kStraight:
>>>>> array = {1, 0, 0, 0,
>>>>> 1, 0, 0, 0,
>>>>> 1, 0, 0, 0,
>>>>> 1, 0, 0, 0};
>>>>> break;
>>>>>
>>>>> case kMulti:
>>>>> array = {0, 1, 0, 0,
>>>>> 1, 1, 0, 0,
>>>>> 0, 1, 0, 0,
>>>>> 0, 0, 0, 0};
>>>>> break;
>>>>>
>>>>> case kZigR:
>>>>> array = {0, 1, 0, 0,
>>>>> 1, 1, 0, 0,
>>>>> 1, 0, 0, 0,
>>>>> 0, 0, 0, 0};
>>>>> break;
>>>>>
>>>>> case kZigL:
>>>>> array = {1, 0, 0, 0,
>>>>> 1, 1, 0, 0,
>>>>> 0, 1, 0, 0,
>>>>> 0, 0, 0, 0};
>>>>> break;
>>>>>
>>>>> default:
>>>>> cout << "SOME SHIT'S BROKEN, YO!";
>>>>>
>>>>> } // switch
>>>>>
>>>>> } // Piece::Piece()
>>>>>
>>>>>
>>>>> kZigL, zBox, etc are enum'ed constants representing which piece is
>>>>> which.
>>>>> i have written the errors im getting as comments on the
>>> corresponding
>>>>> lines -- if anyone can help me with any of them, i would really
>>>>> appreciate it...
>>>>>
>>>>> thanx in advance
>>>>>
>>>>> -- david
>>>>> _______________________________________________
>>>>> studentdev mailing list | email@hidden
>>>>> Help/Unsubscribe/Archives:
>>>>> http://www.lists.apple.com/mailman/listinfo/st> udentdev
>>>>> Do not
>>>>> post admin requests to the list. They will
>>>>> be ignored.
>>>> _______________________________________________
>>>> studentdev mailing list | email@hidden
>>>> Help/Unsubscribe/Archives:
>>>> http://www.lists.apple.com/mailman/listinfo/studentdev
>>>> Do not post admin requests to the list. They will be ignored.
> _______________________________________________
> cocoa-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.
>

--
Clark S. Cox III
email@hidden
http://homepage.mac.com/clarkcox3/
http://homepage.mac.com/clarkcox3/blog/B1196589870/index.html

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: XCode annoyance :-\ (From: David Cairns <email@hidden>)

  • Prev by Date: Re: NSXMLParserTroubles (errors and line/column positions wrong?)
  • Next by Date: Re: XCode annoyance :-\
  • Previous by thread: Re: XCode annoyance :-\
  • Next by thread: Re: XCode annoyance :-\
  • Index(es):
    • Date
    • Thread