gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Procedure Const parameter?


From: Gaius Mulley
Subject: Re: Procedure Const parameter?
Date: Tue, 24 Mar 2020 18:14:47 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Hưng Hưng <address@hidden> writes:

> Free Pascal has this: procedure test(const x: pchar);
>
> What is the equivalent in gm2?
>
> I want a const pointer. e.g:
>
> type test = pointer to integer;
> procedure testit(const x: test);
>
> I need it to be able to complete the translation of the C header to
> gm2.

Hi,

there is no const pointer in Modula-2

you can either use:

example.def

DEFINITION MODULE FOR "C" example ;

TYPE
   ptr = POINTER TO INTEGER ;

PROCEDURE foo (a: ptr) ;
PROCEDURE bar (VAR a: ptr) ;

END example.

fortunately you can either state this as const or without const in your
C file

example.c

void example_foo (const int *a);    /* add/remove const as suits.  */
void example_foo (int **a);    /* add/remove const as suits.  */

etc

regards,
Gaius



reply via email to

[Prev in Thread] Current Thread [Next in Thread]