c3c icon indicating copy to clipboard operation
c3c copied to clipboard

cannot call method on integer literal

Open Book-reader opened this issue 7 months ago • 4 comments

fn int main()
{
  1.is_even(); // Error: Integer suffix 'i' is not valid for a floating point literal.
  return 0;
}

as pointed out here this isn't a huge deal:

Image

Book-reader avatar May 26 '25 11:05 Book-reader

The question is whether 0. style should be allowed or not. Should double d = 3.; be allowed?

lerno avatar May 26 '25 22:05 lerno

My immediate thought would be to disallow it and either add a d suffix to be consistent with allowing 3f, or just require a .0.

Book-reader avatar May 27 '25 03:05 Book-reader

could this also be resolved with brackets?

(5.).is_even()

joshring avatar May 30 '25 00:05 joshring

It could be yes. The question is what the best solution is for C3.

lerno avatar Jun 06 '25 23:06 lerno