9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] pls. HELP porting problem
@ 2005-04-29 10:53 Aharon Robbins
  2005-04-29 11:59 ` Bruce Ellis
  2005-04-29 12:31 ` Brantley Coile
  0 siblings, 2 replies; 15+ messages in thread
From: Aharon Robbins @ 2005-04-29 10:53 UTC (permalink / raw)
  To: 9fans

> in a similar way, one has been able to write
> 	p->f(args)
> rather than
> 	(*p->f)(args)
> for quite some time.

I think this actually worked in the V7 C compiler and PCC, no?

> perhaps it's not in the standard!

It is.  I think maybe even since 1989.

Arnold


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] pls. HELP porting problem
  2005-04-29 10:53 [9fans] pls. HELP porting problem Aharon Robbins
@ 2005-04-29 11:59 ` Bruce Ellis
  2005-04-29 15:15   ` rog
       [not found]   ` <6ea05dc57c13d1df7359ec63990a0f8b@vitanuova.com>
  2005-04-29 12:31 ` Brantley Coile
  1 sibling, 2 replies; 15+ messages in thread
From: Bruce Ellis @ 2005-04-29 11:59 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

PCC had a particularly aggressive disregard for indirections
in such cases.  if 'f' was a pointer to a function then ...

f();
(*f)();
(***************************f)();

produced the same code and no diagnostics.

brucee

On 4/29/05, Aharon Robbins <arnold@skeeve.com> wrote:
> > in a similar way, one has been able to write
> >       p->f(args)
> > rather than
> >       (*p->f)(args)
> > for quite some time.
> 
> I think this actually worked in the V7 C compiler and PCC, no?
> 
> > perhaps it's not in the standard!
> 
> It is.  I think maybe even since 1989.
> 
> Arnold


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] pls. HELP porting problem
  2005-04-29 10:53 [9fans] pls. HELP porting problem Aharon Robbins
  2005-04-29 11:59 ` Bruce Ellis
@ 2005-04-29 12:31 ` Brantley Coile
  2005-04-29 18:06   ` Ah Q
  1 sibling, 1 reply; 15+ messages in thread
From: Brantley Coile @ 2005-04-29 12:31 UTC (permalink / raw)
  To: 9fans

> I think this actually worked in the V7 C compiler and PCC, no?
It did.

  Brantley



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] pls. HELP porting problem
  2005-04-29 11:59 ` Bruce Ellis
@ 2005-04-29 15:15   ` rog
       [not found]   ` <6ea05dc57c13d1df7359ec63990a0f8b@vitanuova.com>
  1 sibling, 0 replies; 15+ messages in thread
From: rog @ 2005-04-29 15:15 UTC (permalink / raw)
  To: bruce.ellis, 9fans

> PCC had a particularly aggressive disregard for indirections
> in such cases.  if 'f' was a pointer to a function then ...
> 
> f();
> (*f)();
> (***************************f)();

surely this is inevitable if f ≡ &f ?



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] pls. HELP porting problem
       [not found]   ` <6ea05dc57c13d1df7359ec63990a0f8b@vitanuova.com>
@ 2005-04-29 15:25     ` Bruce Ellis
  2005-04-29 15:38       ` C H Forsyth
  0 siblings, 1 reply; 15+ messages in thread
From: Bruce Ellis @ 2005-04-29 15:25 UTC (permalink / raw)
  To: rog; +Cc: 9fans

i would never have thought to put in a while loop there.
must have *fixed* some *bug*.  there is no justification
for this behaviour.  if 'f' is of type ptr to fn, then *f is of
type fn ... and it is an expression not a name.  **f should
be illegal etc etc.

brucee

On 4/30/05, rog@vitanuova.com <rog@vitanuova.com> wrote:
> > PCC had a particularly aggressive disregard for indirections
> > in such cases.  if 'f' was a pointer to a function then ...
> >
> > f();
> > (*f)();
> > (***************************f)();
> 
> surely this is inevitable if f ≡ &f ?


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] pls. HELP porting problem
  2005-04-29 15:25     ` Bruce Ellis
@ 2005-04-29 15:38       ` C H Forsyth
  2005-04-29 16:09         ` Bruce Ellis
  0 siblings, 1 reply; 15+ messages in thread
From: C H Forsyth @ 2005-04-29 15:38 UTC (permalink / raw)
  To: 9fans

as i recall, this and several other peculiar effects
were the consequence of the process
by which the tree was rewritten.
it was along these lines.  (i could of course go
off and look at the source but is it worthwhile?)
you might have thought it would leave the types
alone and then when pointer-to-function appeared
as the type of an expression to which () was applied
it would insert a dereference.
but instead it applied the f to &f transformation
so *****f involved not a while loop but repeatedly
introducing &f from the bottom of the tree and having
adjacent *& cancel out (similarly, &*).  thus
	******f
	******&f
	*****f
	*****&f
	****f
	****&f
	***f
etc (i might have got the wrong number of * at some points)

little fleas indeed!



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] pls. HELP porting problem
  2005-04-29 15:38       ` C H Forsyth
@ 2005-04-29 16:09         ` Bruce Ellis
  0 siblings, 0 replies; 15+ messages in thread
From: Bruce Ellis @ 2005-04-29 16:09 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

you'd only notice it if you wanted it to do the right thing
for ptr to ptr to fn etc.

brucee

On 4/30/05, C H Forsyth <forsyth@vitanuova.com> wrote:
> as i recall, this and several other peculiar effects
> were the consequence of the process
> by which the tree was rewritten.
> it was along these lines.  (i could of course go
> off and look at the source but is it worthwhile?)
> you might have thought it would leave the types
> alone and then when pointer-to-function appeared
> as the type of an expression to which () was applied
> it would insert a dereference.
> but instead it applied the f to &f transformation
> so *****f involved not a while loop but repeatedly
> introducing &f from the bottom of the tree and having
> adjacent *& cancel out (similarly, &*).  thus
>        ******f
>        ******&f
>        *****f
>        *****&f
>        ****f
>        ****&f
>        ***f
> etc (i might have got the wrong number of * at some points)
> 
> little fleas indeed!
> 
>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] pls. HELP porting problem
  2005-04-29 12:31 ` Brantley Coile
@ 2005-04-29 18:06   ` Ah Q
  2005-04-29 21:43     ` [9fans] killing none's process arisawa
  2005-04-30  9:03     ` [9fans] pls. HELP porting problem Charles Forsyth
  0 siblings, 2 replies; 15+ messages in thread
From: Ah Q @ 2005-04-29 18:06 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On 4/29/05, Brantley Coile <brantley@coraid.com> wrote:
> > I think this actually worked in the V7 C compiler and PCC, no?
> It did.

I tried this with V7 on simh.

$ ed g.c
?g.c
a
main(){struct{int(*f)();}*s; s->f();}
.
w
38
!cc g.c
g.c:1: Call of non-function
!
!pcc g.c
g.c
"g.c", line 1: compiler error: no table entry for op UCALL
!
s/s->f/(*&)/p
main(){struct{int(*f)();}*s; (*s->f)();}
w
41
!cc g.c
!


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [9fans] killing none's process
  2005-04-29 18:06   ` Ah Q
@ 2005-04-29 21:43     ` arisawa
  2005-04-29 21:48       ` Russ Cox
  2005-04-30  9:03     ` [9fans] pls. HELP porting problem Charles Forsyth
  1 sibling, 1 reply; 15+ messages in thread
From: arisawa @ 2005-04-29 21:43 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello,

Now any user on cpu server can become "none".
Let alice be one of users and execute:
	listen1 someaddr /bin/somecmd
the process will be something like:
--rw-r----- p 0 none bootes   0 Apr 14 12:00 /proc/74/ctl
then how alice can kill the process?
(note that "none" cannot kill any other process)

Thanks

Kenji Arisawa



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] killing none's process
  2005-04-29 21:43     ` [9fans] killing none's process arisawa
@ 2005-04-29 21:48       ` Russ Cox
  0 siblings, 0 replies; 15+ messages in thread
From: Russ Cox @ 2005-04-29 21:48 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> then how alice can kill the process?

she can't.  only hostowner can kill the process.

russ


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] pls. HELP porting problem
  2005-04-29 18:06   ` Ah Q
  2005-04-29 21:43     ` [9fans] killing none's process arisawa
@ 2005-04-30  9:03     ` Charles Forsyth
  1 sibling, 0 replies; 15+ messages in thread
From: Charles Forsyth @ 2005-04-30  9:03 UTC (permalink / raw)
  To: 9fans

>>!pcc g.c
>>g.c
>>"g.c", line 1: compiler error: no table entry for op UCALL

i don't know about the pdp11 but it worked in the other
PCCs because i used it extensively to do modules.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] pls. HELP porting problem
  2005-04-29  6:10 ` geoff
@ 2005-04-29  8:20   ` Charles Forsyth
  0 siblings, 0 replies; 15+ messages in thread
From: Charles Forsyth @ 2005-04-29  8:20 UTC (permalink / raw)
  To: 9fans

in a similar way, one has been able to write
	p->f(args)
rather than
	(*p->f)(args)
for quite some time.

perhaps it's not in the standard!
in which case, i'm sorry, don't use it, but moan to yourself each time you can't.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] pls. HELP porting problem
  2005-04-29  5:53 pac7
  2005-04-29  6:01 ` boyd, rounin
@ 2005-04-29  6:10 ` geoff
  2005-04-29  8:20   ` Charles Forsyth
  1 sibling, 1 reply; 15+ messages in thread
From: geoff @ 2005-04-29  6:10 UTC (permalink / raw)
  To: 9fans

In C, writing the bare name of a function or array, say `foo', is
equivalent to writing &foo, so just delete the `&' if you want to
eliminate the warning.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] pls. HELP porting problem
  2005-04-29  5:53 pac7
@ 2005-04-29  6:01 ` boyd, rounin
  2005-04-29  6:10 ` geoff
  1 sibling, 0 replies; 15+ messages in thread
From: boyd, rounin @ 2005-04-29  6:01 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

this goes at to very top of thr file:

    #include <u.h>
    #include <libc.h>

and this:

    #define GSL_FN_EVAL(F,x) (*((F)->function))(x,(F)->params)

is just plain ugly or non functional.
--
MGRS 31U DQ 52572 12604




^ permalink raw reply	[flat|nested] 15+ messages in thread

* [9fans] pls. HELP porting problem
@ 2005-04-29  5:53 pac7
  2005-04-29  6:01 ` boyd, rounin
  2005-04-29  6:10 ` geoff
  0 siblings, 2 replies; 15+ messages in thread
From: pac7 @ 2005-04-29  5:53 UTC (permalink / raw)
  To: 9fans

/* code from a native port: */
/* Definition of an arbitrary function with parameters */
struct gsl_function_struct 
{
  double (* function) (double x, void * params);
  void * params;
};
typedef struct gsl_function_struct gsl_function ;
#define GSL_FN_EVAL(F,x) (*((F)->function))(x,(F)->params)


/* Declarations */
gsl_function weighted_function;
static double fn_cauchy (double x, void *params);


/* main (foo.c)*/
#include <u.h>
#include <libc.h>
/* line 55 :*/
      weighted_function.function = &fn_cauchy;
      weighted_function.params = &fn_params;
=====>
mk: warning: foo.c:55 qawo.c:39 address of array/func ignored

Q1: Why?
Q2: Reccommended workaround??

tx,
++pac.




-- 
Levnější internet v pracovní dny již od 18:00 hod.
Surfujte s VOLNÝ!
http://mimospicku.volny.cz



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2005-04-30  9:03 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-29 10:53 [9fans] pls. HELP porting problem Aharon Robbins
2005-04-29 11:59 ` Bruce Ellis
2005-04-29 15:15   ` rog
     [not found]   ` <6ea05dc57c13d1df7359ec63990a0f8b@vitanuova.com>
2005-04-29 15:25     ` Bruce Ellis
2005-04-29 15:38       ` C H Forsyth
2005-04-29 16:09         ` Bruce Ellis
2005-04-29 12:31 ` Brantley Coile
2005-04-29 18:06   ` Ah Q
2005-04-29 21:43     ` [9fans] killing none's process arisawa
2005-04-29 21:48       ` Russ Cox
2005-04-30  9:03     ` [9fans] pls. HELP porting problem Charles Forsyth
  -- strict thread matches above, loose matches on Subject: below --
2005-04-29  5:53 pac7
2005-04-29  6:01 ` boyd, rounin
2005-04-29  6:10 ` geoff
2005-04-29  8:20   ` Charles Forsyth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).