[Mono-devel-list] Null Attributes arguments

Marek Safar marek.safar at seznam.cz
Thu Dec 9 10:30:11 EST 2004


Hello Paolo,

>On 12/09/04 Marek Safar wrote:
>  
>
>>This patch implements NULL arguments support for attributes.
>>OK to commit ?
>>    
>>
>
>Do you have a test case?
>  
>

Sure, it is improved TC for bug
http://bugzilla.ximian.com/show_bug.cgi?id=67412

>  
>
>>Index: reflection.c
>>===================================================================
>>--- reflection.c	(revision 37473)
>>+++ reflection.c	(working copy)
>>@@ -7041,7 +7041,13 @@
>> 		break;
>> 	}
>> 	/* it may be a boxed value or a Type */
>>-	case MONO_TYPE_OBJECT: {
>>+	case MONO_TYPE_OBJECT: {
>>+		if (arg == NULL) {
>>+			*p++ = MONO_TYPE_STRING;
>>+			*p++ = 0xFF;
>>+			break;
>>+		}
>>+		
>> 		MonoClass *klass = mono_object_class (arg);
>> 		char *str;
>> 		guint32 slen;
>>    
>>
>
>You can't add statements before local var declarations: it breaks
>older compilers (of course you need to move the 
>	klass = mono_object_class (arg);
>assignment after the added NULL check).
>Using MONO_TYPE_STRING is also very likely wrong at least
>conceptually. Please post also a test case.
>  
>
Maybe yes but it seems to me that it is exactly same hack as Microsoft 
added to handle this null value. I think they don't update a specification.

Marek

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-329.cs
Type: text/x-csharp
Size: 378 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20041209/8bd89e5f/attachment.bin 


More information about the Mono-devel-list mailing list