Mike B.
unread,Feb 6, 2023, 5:58:47 PM2/6/23You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hi!
I like to reuse the arguments of a C function passed by value. Why waste space. BUT - don't do that with the function arguments for a process!
#include <process.h>
#include <stdlib.h>
#include <stdio.h>
void newproc( Process *p, int arg1, int arg2, int arg3 ) {
p = p;
printf( "arg1=%d, arg2=%d, arg3=%d\n", arg1, arg2, arg3 );
arg3--;
arg2++; /* don't change process arguments even they were passed by value !!! */
}
int main( void ) {
Process *x;
int pa1 = 1, pa2 = 2, pa3 = 3;
if (( x = ProcAlloc( newproc, 0, 3, pa1, pa2, pa3 )) == NULL ) abort();
ProcPar( x, NULL );
ProcPar( x, NULL );
ProcPar( x, NULL );
return 0;
}
ubuntu@kria:~$ $ISERVER -sb proc.btl
arg1=1, arg2=2, arg3=3
arg1=1, arg2=3, arg3=2
arg1=1, arg2=4, arg3=1
-Mike