in a more accurate way:

#include <stdio.h>

long __auto_increment = 0;

typedef struct {
        long *addr;
        void *value;
} Object;

Object ObjectNew(void *value) {
        Object obj;
        long i = __auto_increment++;
        
        obj.addr = &i;
        obj.value = value;
        
        return obj;
}

int main (void) {
        Object obj;
        Object *obj_1;
        Object *obj_2;
        int i = 0;
        
        char *value = "hello world!";
                
        while (++i < 5) {
                obj = ObjectNew(value);
                obj_1 = &obj;
                obj_2 = obj_1;
                
                printf("obj_1.addr = %#x, obj_1.value = %s \n",
                        obj_1->addr, obj_1->value);
                        
                printf("obj_2.addr = %lo, obj_2.value = %s \n",
                        *(long *)obj_2->addr, obj_2->value);
        }
        
        return 0;
}



On Sat, Aug 2, 2008 at 9:50 AM, mm w <[EMAIL PROTECTED]> wrote:
> Hi I'm sorry, it's not a confusion, it's only a bad knowledge of C, and
> "pointers" are not understood, NS and what about CF or every-prefix in the 
> world
>  of frameworks gtk_object ... kobject ...
>
> #include <stdio.h>
>
> long __auto_increment = 0;
>
> typedef struct {
>        long *addr;
>        void *value;
> } Object;
>
> Object ObjectNew(void *value) {
>        Object obj;
>        long i = __auto_increment++;
>
>        obj.addr = &i;
>        obj.value = value;
>
>        return obj;
> }
>
> int main (void) {
>        Object obj;
>        Object *obj_1;
>        Object *obj_2;
>
>        char *value = "hello world!";
>        obj = ObjectNew(value);
>
>        obj_1 = &obj;
>        obj_2 = obj_1;
>
>        printf("obj_1.addr = %x, obj_1.value = %s \n",
>                obj_1->addr, obj_1->value);
>
>        printf("obj_2.addr = %x, obj_2.value = %s \n",
>                obj_1->addr, obj_1->value);
>
>        return 0;
> }
>
> On Sat, Aug 2, 2008 at 12:05 AM, Negm-Awad Amin <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> Am Fr,01.08.2008 um 22:07 schrieb Giulio Cesare Solaroli:
>>
>>> On Fri, Aug 1, 2008 at 10:01 PM, Clark Cox <[EMAIL PROTECTED]> wrote:
>>>>
>>>> On Fri, Aug 1, 2008 at 12:38 PM, Arthur Coleman <[EMAIL PROTECTED]>
>>>> wrote:
>>>>>
>>>>> I hate to be dense, but what about C structs like NSRect?  There are
>>>>> initialized on the stack aren't they?
>>>>
>>>> They're C structs, they aren't Objective-C objects.
>>>
>>> That's very true, but the common NS prefix used by both full obj-c
>>> classes and simple C structures may lead to some confusion, mainly for
>>> someone learning obj-c and Cocoa.
>>
>> yup, sometimes people are confused about the NS-prefix. But NS means
>> NextStep, so refers to the  framework *not* to the type. It is no good idea
>> to use hungarian notation in objective-c.
>>
>> Amin
>>
>>>
>>>
>>> Giulio Cesare
>>> _______________________________________________
>>>
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>>
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de
>>>
>>> This email sent to [EMAIL PROTECTED]
>>
>> Amin Negm-Awad
>> [EMAIL PROTECTED]
>>
>>
>>
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com
>>
>> This email sent to [EMAIL PROTECTED]
>>
>
>
>
> --
> -mmw
>



-- 
-mmw
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to