Jump to content
Sign in to follow this  
Steve Mynott

How to declare negative ints in Action! ?

Recommended Posts

I'm trying to declare and initialize an int like

 

int foo=[-1]

 

and just get

 

Error: Not a constant

int foo=[-1]

Error: 9

 

Any ideas?

 

 

Share this post


Link to post
Share on other sites

I couldn't find anything in the manual, but it appears to work if you declare int foo separately from setting its value.

 

INT foo

foo=-123

PrintIE(foo)

 

works.

Share this post


Link to post
Share on other sites

What are the square brackets for? Do they not attempt to define an array of negative size? Does int foo=-1 not work?

 

value assignment through declaration

Share this post


Link to post
Share on other sites

Convoluted logic on my part. :) Probably Mr. Parker was so focused on getting the indirection and pointer thing right that it took priority over what should have been an obvious option with a 16k cart. It probably could be fixed if people can't tolerate the work around Kyle presented.

 

The indirection/pointer thing.

 

Proc Main()

Byte Right_Margin=82, My_Margin=[0]

;Right_Margin refers/points to memory location 82, My_Margin is a byte somewhere in memory whose location is decided by the cart and initialized to the value 0

Right_Margin=My_Margin

;Uses the pointer Right_Margin to store the value of My_Margin<0> in memory location 82

Return

 

So things like memory location -1 weren't really a priority to implement in declarations since it sort of doesn't exist other then by wrap. 16k [compiler, editor, runtime] space problem. Matter of fact, if you are a professor of computer science, you may have even left it out/made it an error on purpose. It is one of the reasons why I like Action since there is still a way to do what you want to do, you just have to be serious about it and really mean it!

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...