This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Reference to "DNUM" when compiled with strict-ansi

I have some code that I'm trying to build for the c674 elf target and it references the DNUM register. This code builds fine, but when I turn on the 'strict ansi' flag for the compiler

(-ps), compilation fails at the DNUM reference:-

line 439: error: identifier "DNUM" is undefined

DNUM has been defined in the same file as follows:-
extern cregister volatile unsigned int DNUM;

Could someone comment on whether I should be able to do this ? And why it fails ?
Thanks,
Gunjan
  • The keyword cregister is a language extension.  The strict ansi flag is supposed to generate errors any time you use any language extension.  If you really want to use cregister and -ps together, then prepend two underscores to the language extension keyword:

    extern __cregister volatile unsigned int DNUM;

    Thanks and regards,

    -George

  • I was about to update this post saying the issue was 'cregister' and not DNUM. But thanks George, prepending two underscores to cregister, worked.

    Thanks