gm2
[Top][All Lists]
Advanced

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

Re: What is the equivalent of C's void type?


From: Hưng Hưng
Subject: Re: What is the equivalent of C's void type?
Date: Wed, 25 Mar 2020 13:49:25 +0700

Yep. I checked the header for opengl of Free Pascal, it just commented out this typedef because we will have no use of it, it only matter to C.

BTW, I gave up on translating the header. It's very easy for me to do the translation, though. But I lacked the programming ability to automate it. Doing by hand with find and replace worked well but too tired and time consuming. People with programming skill will just write a batch job, a macro or a parser to do the job for them automatically. I hope Gaius could bring back a fully working h2def. It will help the job very much. He said he removed it because it's currently unstable. Given the similarity between M2 and Pascal I would suggest him to fork Free Pascal's h2pas and adapt it for GM2. About myself, as I'm too tired I would come back to my daily farming job and skip programming for a while. Bye.

Vào Th 4, 25 thg 3, 2020 vào lúc 12:22 Benjamin Kowarsch <address@hidden> đã viết:
No, void is not a data type. You cannot allocate a variable of "type" void. It is an attribute indicating "no type".

The typedef in the header file you linked is merely an alias name for the function modifier that means "this function has no type".

On Wed, 25 Mar 2020 at 14:06, Hưng Hưng <address@hidden> wrote:
Someone want me to write a binding for opengl. In gl we have a typedef GLvoid with void, so void should be considered as a data type. There is other headers, when function parameters were declared as void, e.g: int some_func(void x, ...); How could I deal with this?


Vào Th 4, 25 thg 3, 2020 vào lúc 11:08 Benjamin Kowarsch <address@hidden> đã viết:
C does not have a void type.

Void is a modifier keyword that is used in place of the return type in a function declaration to indicate that the function does not have a return type, that is to say it does not return any value, or in other words it is not actually a function but a procedure.

In Modula-2 procedures are declared like functions but simply omit the return type.

A C procedure declaration ...

void foobar ( baz bam );

becomes

PROCEDURE foobar ( bam : baz );

in Modula-2.

On Wed, 25 Mar 2020 at 12:45, Hưng Hưng <address@hidden> wrote:
I mean C void type, not void pointer. I can't found anywhere mention it.

reply via email to

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