From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Thu, 8 Sep 1994 14:13:30 -0400 From: bobf@plan9.research.att.com bobf@plan9.research.att.com Subject: No subject Topicbox-Message-UUID: 033be2a4-eac8-11e9-9e20-41e7f4b1d025 Message-ID: <19940908181330.lJv12i-1hLMHGKpB1wKCXGnBGDlcRrMnqL3vFVF1pFA@z> > #include > > void > main(int argc, byte **argv) > { > rescue { > print("1"); > return; > } > rescue { > print("2"); > raise ; > } > raise ; > } this is a compiler bug that has been fixed. > enum {TEXT, AUDIO, VIDEO, MULTI}; > > void (*f[]) = { /* I'm not sure about f or Mesg.f */ > [TEXT] Mime.ldtext(), > [AUDIO] Mime.ldaudio(), > [VIDEO] Mime.ldvideo(), > [MULTI] Mime.ldmulti(), > }; > > and later do (*f[type])(); /* this avoid switch or if else */ use the form ..function to refer to the functions. [TEXT] .Mime.ldtext, [AUDIO] .Mime.ldaudio, [VIDEO] .Mime.ldvideo, [MULTI] .Mime.ldmulti, works with our compiler. > adt Mime{ > ..... > void write(*Mime,int); > }; > > adt Mesg { > ..... > Mime; > void write(*Mesg,int); > }; > > If I want to access Mime.write through a Mesg object, Is it > save to use casting? > > void > Mesg.write(Mesg *m,int) > > ((Mime *)m)->write(0); /* in order to call MIME.write */ > } unnamed members can be referenced by their type name. use m->Mime.write(0); we are working on a new plan 9 distribution. it contains an Alef compiler with many bug fixes, some new features, and improved documentation.