Algol (1958) is the spiritual parent language of the C/C++/C#/Java family. It introduced the accursed "int x" syntax which Niklaus Wirth tried to undo with Pascal and other designs. Yet the notation persists and perpetures a 60-year confusion around types and values.
-
-
This confusion doesn't exist in Pascal or Typescript syntax. "int" refers to the type, and ":int" is always an abstract placeholder for a particular value. The type-value dissonance is stretched to the breaking point when they're mixed as in C++ template partial specialization.
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
I don't get the difference, I think both cases accept a type and int is a type in both of them.
-
int f(int) {return 3;} is shorthand for f(0)=3, f(1)=3, f(2)=3, .. with each integer substituting into that "int" placeholder. Whereas array is a compile-time function from types to types, and array<int> produces the type of arrays of integers.
- 3 more replies
New conversation -
-
-
shouldn't use it anyhow as its size is indeterminate. , int16_t , int32_t int64_t etc. fixed :)
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
IMO there is no confusion at all. In every case "int" means exactly the type "int", never the "type of all integers"! You are mixing templates with "int" parameters (array<int>) with functions with "int" arguments. Both are entirely different mechanics that cannot get confused!
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.