Jump to content
Sign in to follow this  
joli

Preprocessor Question

Recommended Posts

#define CNTADDR			 0x0120	  // First address in the Bank 2
#define CNTSIZE			 0x0012	  // 18 decimal

uchar   counters[CNTSIZE]   @CNTADDR;
uchar   countix			 @CNTADDR + CNTSIZE;

 

In the code above, why preprocessor can't resolve "countix" address and compiler give me a general error on this last line?

 

Why it happens one time compiler know what address should apply to the counters[CNTSIZE] and unknow a simple CNTADDR + CNTSIZE address calculation to apply for the countix variable?

 

 

Regards.

Share this post


Link to post
Share on other sites
#define CNTADDR			 0x0120	  // First address in the Bank 2
#define CNTSIZE			 0x0012	  // 18 decimal

uchar   counters[CNTSIZE]   @CNTADDR;
uchar   countix			 @CNTADDR + CNTSIZE;

 

In the code above, why preprocessor can't resolve "countix" address and compiler give me a general error on this last line?

 

Why it happens one time compiler know what address should apply to the counters[CNTSIZE] and unknow a simple CNTADDR + CNTSIZE address calculation to apply for the countix variable?

 

 

Regards.

Nobody's of sourceboost has an answer?

This is a situation to be resolved in an next release? eg. v6.98?

Or the question rised is meaningless?

 

Regards,

Joli

Share this post


Link to post
Share on other sites
In the code above, why preprocessor can't resolve "countix" address and compiler give me a general error on this last line?

 

Preprocessor does not evaluate any expressions. It's job if to process include files, handle ifdef logic and do macro substitutions. All calculations are done by compiler. In this case compiler was written so that it does not handle expressions in fixed address part of declarations. We added this to our todo list for v7. For now please don't use expressions in the fixed address part in declarations.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites
In the code above, why preprocessor can't resolve "countix" address and compiler give me a general error on this last line?

 

Preprocessor does not evaluate any expressions. It's job if to process include files, handle ifdef logic and do macro substitutions. All calculations are done by compiler. In this case compiler was written so that it does not handle expressions in fixed address part of declarations. We added this to our todo list for v7. For now please don't use expressions in the fixed address part in declarations.

 

Regards,

Pavel

Thank you for clarifying.

I hope that this will be included in V.7.

 

Regards,

Joli

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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  

×
×
  • Create New...