Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!uunet!mcsun!hp4nl!let.rug.nl!eoo From: eoo@let.rug.nl (Eize Oosting) Newsgroups: comp.lang.c Subject: Re: missing ->= operator Message-ID: <1667@gufalet.let.rug.nl> Date: 30 Apr 91 22:29:16 GMT References: <9104291641.AA00534@dutiaa.tudelft.nl> Organization: Faculty of Arts, Groningen, The Netherlands Lines: 34 In article <9104291641.AA00534@dutiaa.tudelft.nl> schuller@DUTIAA.TUDELFT.NL (Schuller Schuller Oijen) writes: >Hi all, >recently I've been doing a lot of C pointer programming and I came upon >a missing feature in C. Suppose you have this struct called mygod : > typedef struct mygod > { > int value; > struct mygod *next; > } mygod_struct >What you do quite often is : mygodptr = mygodptr->next; >Now C has all these wonderful operators : a += 7, g &= 0xf, etc, etc. >But the ->= operator is missing! You cannot do mygodptr ->= next; ! >All of you who want to fill this gap, please react. Flames to /dev/null. >Bye! Hildo Biersma, schuller@dutiad.tudelft.nl It sounds wonderfull, but it would ask for an Object Oriented style, and C is just not OO. Maybe this would be something for C++. What you can do is something like this: #define NEXT(ptr) ptr = ptr->next It isn't the nicest solution, but it works. /\__________/\ /\___________________________________________________/\ / \ / \ | Letteren- | Marvin Minsky once defined Artificial Intelligence as: | | Faculteit | '... the science of making machines do things that | | R.U. Groningen | would require intelligence if done by men'. | | The Netherlands| | | | Does this include formatting a floppy? | | eoo@let.rug.nl | Eize Oosting | \ __________ / \ ___________________________________________________ / \/ \/ \/ \/