FROM : Aaron Boothello
DATE : Sat Apr 16 12:58:01 2005
Hmmm
tried it, didnt work.
The actual code is as follows:
typedef double matrix[16];
#define SET_ENTRY(m,r,c,e) (m[r*4+c] = e)
the 'macro' is called as follows (example):
SET_ENTRY(ret,1,1,4.5); //where ret is of type matrix
error generated is:incompatible types in assignment.
-Aaron
On Saturday, April 16, 2005, at 05:11PM, Justin Spahr-Summers <justin.<email_removed>> wrote:
>Perhaps it's your typedef line? Maybe you meant
>
>typedef double[16] matrix;
>
>I'm not even sure if that will work.
>
>On 4/16/05, Aaron Boothello <<email_removed>> wrote:
>> Well yeah....
>> the code looks like that. it's not exactly what i typed in....it does the calculating of the rows and columns just fine. It's actually making the assignment. 'value' is a double and the elements in matrix are doubles. But i keep getting 'incompatible types in assignments'...
>>
>> (and it seems like the error is in "matrix[whatever] = value" for some reason)
>> i cant seem to figure if it's a syntax error or what ? how would you set a value in a #define ?
>>
>> Cheers,
>> Aaron.
>>
>> On Saturday, April 16, 2005, at 04:25PM, p3consulting <<email_removed>> wrote:
>>
>> >>
>> >> #define setvalue(matrix, row, col, value) ( matrix[row+col] = value)
>> >> //roughly looks like this
>> >>
>> >
>> >row + col ?
>> >
>> >0 + 3 = 3 + 0
>> >
>> >and obviously is not what you want...
>> >
>> >((row * 4) + col)
>> >((0 * 4) + 3) == 3 and ((3 * 4) + 0) == 12
>> >
>> >+
>> >
>> >row and col being indices in an array
>> >should be int not double...
>> >
>> >
>> >(#define are not a good idea for this kind of application..., just an
>> >opinion)
>> >
>> >
>> >Pascal Pochet
>> ><email_removed>
>> >----------------------------------
>> >PGP
>> >KeyID: 0x208C5DBF
>> >Fingerprint: 9BFB 245C 5BFE 7F1D 64B7 C473 ABB3 4E83 208C 5DBF
>> >
>> >
> _______________________________________________
>Do not post admin requests to the list. They will be ignored.
>Cocoa-dev mailing list (<email_removed>)
>Help/Unsubscribe/Update your Subscription:
>http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
>This email sent to <email_removed>
>
>
DATE : Sat Apr 16 12:58:01 2005
Hmmm
tried it, didnt work.
The actual code is as follows:
typedef double matrix[16];
#define SET_ENTRY(m,r,c,e) (m[r*4+c] = e)
the 'macro' is called as follows (example):
SET_ENTRY(ret,1,1,4.5); //where ret is of type matrix
error generated is:incompatible types in assignment.
-Aaron
On Saturday, April 16, 2005, at 05:11PM, Justin Spahr-Summers <justin.<email_removed>> wrote:
>Perhaps it's your typedef line? Maybe you meant
>
>typedef double[16] matrix;
>
>I'm not even sure if that will work.
>
>On 4/16/05, Aaron Boothello <<email_removed>> wrote:
>> Well yeah....
>> the code looks like that. it's not exactly what i typed in....it does the calculating of the rows and columns just fine. It's actually making the assignment. 'value' is a double and the elements in matrix are doubles. But i keep getting 'incompatible types in assignments'...
>>
>> (and it seems like the error is in "matrix[whatever] = value" for some reason)
>> i cant seem to figure if it's a syntax error or what ? how would you set a value in a #define ?
>>
>> Cheers,
>> Aaron.
>>
>> On Saturday, April 16, 2005, at 04:25PM, p3consulting <<email_removed>> wrote:
>>
>> >>
>> >> #define setvalue(matrix, row, col, value) ( matrix[row+col] = value)
>> >> //roughly looks like this
>> >>
>> >
>> >row + col ?
>> >
>> >0 + 3 = 3 + 0
>> >
>> >and obviously is not what you want...
>> >
>> >((row * 4) + col)
>> >((0 * 4) + 3) == 3 and ((3 * 4) + 0) == 12
>> >
>> >+
>> >
>> >row and col being indices in an array
>> >should be int not double...
>> >
>> >
>> >(#define are not a good idea for this kind of application..., just an
>> >opinion)
>> >
>> >
>> >Pascal Pochet
>> ><email_removed>
>> >----------------------------------
>> >PGP
>> >KeyID: 0x208C5DBF
>> >Fingerprint: 9BFB 245C 5BFE 7F1D 64B7 C473 ABB3 4E83 208C 5DBF
>> >
>> >
> _______________________________________________
>Do not post admin requests to the list. They will be ignored.
>Cocoa-dev mailing list (<email_removed>)
>Help/Unsubscribe/Update your Subscription:
>http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
>This email sent to <email_removed>
>
>
| Related mails | Author | Date |
|---|---|---|
| Aaron Boothello | Apr 16, 09:44 | |
| Justin Spahr-Summe… | Apr 16, 10:09 | |
| Aaron Boothello | Apr 16, 10:13 | |
| p3consulting | Apr 16, 10:25 | |
| Aaron Boothello | Apr 16, 10:35 | |
| Justin Spahr-Summe… | Apr 16, 11:10 | |
| Aaron Boothello | Apr 16, 12:58 | |
| Cameron Hayne | Apr 17, 06:47 | |
| Andrew White | Apr 18, 05:54 | |
| Michael Rothwell | Apr 22, 04:37 | |
| Steve Checkoway | Apr 26, 07:04 |






Cocoa mail archive

