Replies: 1 comment
-
Hm, where are you getting these strange ideas from?
Code in UNSAFE modules works exactly the way it does in safe modules. The
only change is that certain rules are relaxed.
So certainly you can NEW in an UNSAFE module.
If you are trying to NEW something that you want to manage yourself, you
need to declare the object to be UNTRACED (that is, not traced by the
garbage collector). This you don't need to be in an UNSAFE module to do.
What you do need to be in an UNSAFE module to do is to free the object,
using DISPOSE.
BITSIZE, BYTESIZE, and ADRSIZE let you compute the size of objects.
Mika
…On Wed, Sep 14, 2022, 2:03 PM zpu2tw ***@***.***> wrote:
From the document it seems NEW can't be used with UNSAFE MODULE (I'm
writing an unsafe module). This caused me to resort back to C's calloc and
malloc. But the problem is there is no sizeof like on C, how could we know
the size of a structure to allocate the needed memory for it? Please help.
https://modula3.github.io/cm3/reference/complete/html/2_6_9New.html
—
Reply to this email directly, view it on GitHub
<#1081>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKYNJPWNA4OHAWEPYZS4KDV6G5IDANCNFSM6AAAAAAQMLBTMA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
From the document it seems NEW can't be used with UNSAFE MODULE (I'm writing an unsafe module). This caused me to resort back to C's calloc and malloc. But the problem is there is no sizeof like on C, how could we know the size of a structure to allocate the needed memory for it? Please help.
https://modula3.github.io/cm3/reference/complete/html/2_6_9New.html
Beta Was this translation helpful? Give feedback.
All reactions