Compilation error related to function millis()

I am using Arduino 2.3.10 CLI Version 1.5.1 and processor Atmega 328P on Windows11.
I inadvertently used millis in a statement instead of millis(). The sketch compiled without error, but it should not have compiled and the following message should have been displayed:
"Compilation error: 'millis' was not declared in this scope"

I moved your topic to an appropriate forum category .

In the future, when creating a topic please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

It should not display an error as the use of millis is basically valid; it's a pointer to the millis() function.

When using millis instead of millis() the compiler will throw a warning with the below code if you set Compiler warnings to All under File → Preferences.

Demo code:

void setup()

{
  Serial.begin(115200);
}



void loop()

{
  uint32_t time = millis;
  Serial.println(time);
  delay(1000);
}

Warning message

C:\Users\bugge\AppData\Local\Temp\.arduinoIDE-unsaved2026109-12544-1tvww2w.hncdi\sketch_nov9a\sketch_nov9a.ino: In function 'void loop()':
C:\Users\bugge\AppData\Local\Temp\.arduinoIDE-unsaved2026109-12544-1tvww2w.hncdi\sketch_nov9a\sketch_nov9a.ino:8:19: warning: invalid conversion from 'long unsigned int (*)()' to 'uint32_t {aka long unsigned int}' [-fpermissive]
   uint32_t time = millis;
                   ^~~~~~

Well, if millis() (which you wanted to use) was declared in the scope, then millis was obviously declared there too. And it is (at least for atmega328) declared in Arduino.h, which is included by IDE.

millis() is calling the address millis (entry point of the function) with zero parameters and returning unsigned long . millis is address of the function (in range 0..16384) and can be used as value (of some pointer type - long unsigned int (*)()) to store the address, or converted to integer and used as this integer (which is not recomended, but is not errorr.

Basically both millis() and millis may be used in the same place, both having different meaning, where millis() will call function millis and return different value nearly each time, while millis will return address of function millis each time the same, and if warnings are turned on also warning about invalid conversion (of pointer to integer type).

Both variants have their good usage, but the usage is different for them.
Well the second shold be used with better type of variable to store it (or with casting the type), but the compiler is able to manage it somehow.

And without warning. Which is because by default, the compiler is muzzled by the Arduino IDE setup. It won't give you warnings. It's supposed to make it more warm and fuzzy, I suppose, but as you've discovered, it's a little like taking the warning labels off all the power tools and setting you loose in a machine shop! As @sterretje already suggested, turn your compiler warnings to ALL and leave it there. You will be amazed appalled at the things that made the compiler go hmmm, but wasn't allowed to tell you about.

And how bad some of the common library routines are, It appears that some submitters never check the warning messages.