Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Useful feature for next version of C

Name: Anonymous 2009-07-26 20:31

A ->= operator, and possibly .=, which would make it easier to go through linked lists and other such structures with lots of pointers. Instead of writing

p = p -> next;

it can now be

p ->= next;

or, if you're working with binary trees, instead of


while(t && t->v != i)
 if(t->v < i)
  t = t -> l;
 else
  t = t -> r;


it becomes


while(t && t->v != i)
 t ->= (t->v < i) ? l : r;


I'm working on a C-like compiler and I thought this would be a good idea.

Name: =+=*=F=R=O=Z=E=N==V=O=I=D=*=+= !frozEn/KIg 2009-07-28 17:45

I use macros within macros. It helps reduce clutter and can be manipulated easily. e.g.
#define MAXBUF 1000
#define NMAX MAXBUF*8


_________________________________________
http://xs135.xs.to/xs135/09042/av922.jpg
Velox Et Astrum gamedev forum: http://etastrum.phpbb3now.com
We've arranged a civilization in which most crucial elements profoundly depend on science and technology. We have also arranged things so that almost no one understands science and technology. This is a prescription for disaster. We might get away with it for awhile, but sooner or later this combustible mixture of ignorance and power is going to blow up in our faces.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List