{"action":"created","issue":{"url":"https://api.github.com/repos/Zeex/pawn/issues/44","labels_url":"https://api.github.com/repos/Zeex/pawn/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/Zeex/pawn/issues/44/comments","events_url":"https://api.github.com/repos/Zeex/pawn/issues/44/events","html_url":"https://github.com/Zeex/pawn/issues/44","id":64115965,"number":44,"title":"Sizeof for enums","user":{"login":"Misiur","id":752692,"avatar_url":"https://avatars.githubusercontent.com/u/752692?v=3","gravatar_id":"","url":"https://api.github.com/users/Misiur","html_url":"https://github.com/Misiur","followers_url":"https://api.github.com/users/Misiur/followers","following_url":"https://api.github.com/users/Misiur/following{/other_user}","gists_url":"https://api.github.com/users/Misiur/gists{/gist_id}","starred_url":"https://api.github.com/users/Misiur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Misiur/subscriptions","organizations_url":"https://api.github.com/users/Misiur/orgs","repos_url":"https://api.github.com/users/Misiur/repos","events_url":"https://api.github.com/users/Misiur/events{/privacy}","received_events_url":"https://api.github.com/users/Misiur/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-03-24T22:30:22Z","updated_at":"2015-03-29T13:23:56Z","closed_at":null,"body":"I'm not certain how compiler handles enumerators, but sizeof doesn't bode well with hidden array sizes:\r\n```pawn\r\nenum E_TEST {\r\n    RandomValue,\r\n    StringValue[64]\r\n};\r\n\r\nnew Anything[MAX_PLAYERS][E_TEST];\r\n\r\n//...\r\nsizeof Anything[0][StringValue]; //1 - it makes sense for compiler, but not for average user\r\n```"},"comment":{"url":"https://api.github.com/repos/Zeex/pawn/issues/comments/87413062","html_url":"https://github.com/Zeex/pawn/issues/44#issuecomment-87413062","issue_url":"https://api.github.com/repos/Zeex/pawn/issues/44","id":87413062,"user":{"login":"Y-Less","id":991078,"avatar_url":"https://avatars.githubusercontent.com/u/991078?v=3","gravatar_id":"","url":"https://api.github.com/users/Y-Less","html_url":"https://github.com/Y-Less","followers_url":"https://api.github.com/users/Y-Less/followers","following_url":"https://api.github.com/users/Y-Less/following{/other_user}","gists_url":"https://api.github.com/users/Y-Less/gists{/gist_id}","starred_url":"https://api.github.com/users/Y-Less/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Y-Less/subscriptions","organizations_url":"https://api.github.com/users/Y-Less/orgs","repos_url":"https://api.github.com/users/Y-Less/repos","events_url":"https://api.github.com/users/Y-Less/events{/privacy}","received_events_url":"https://api.github.com/users/Y-Less/received_events","type":"User","site_admin":false},"created_at":"2015-03-29T13:23:56Z","updated_at":"2015-03-29T13:23:56Z","body":"I've always seen \"1\" here as the correct return.  This enum:\r\n\r\n```pawn\r\nenum X\r\n{\r\n    A,\r\n    B[10],\r\n    C\r\n}\r\n```\r\n\r\nIs entirely equivalent to:\r\n\r\n```pawn\r\nenum X\r\n{\r\n    A,\r\n    B,\r\n    C = B + 10\r\n}\r\n```\r\n\r\nOr:\r\n\r\n```pawn\r\n#define A X_tag:0\r\n#define B X_tag:1\r\n#define C X_tag:11\r\n#define X X_tag:12\r\n```\r\n\r\nPeople would entirely expect \"sizeof (B)\" to return \"1\" there.  \"B\" is just a subset of \"X\", asking for its size is asking for the size of part of an array, not the whole array, and with this patch not even an element of the array.\r\n\r\nAlso, I have always said \"enums are not arrays\" - they are flattened by the compiler.  Doing:\r\n\r\n```pawn\r\nnew arr[X];\r\narr[B][3];\r\n```\r\n\r\nIs just fancy syntax for:\r\n\r\n```pawn\r\nnew arr[X];\r\narr[B + X_tag:3];\r\n```\r\n\r\nI didn't comment on this earlier, as if a majority of people think it should be different (as even the later official versions of PAWN seem to think it should) then who am I to argue?  But as I say, given everything here, I don't think it makes sense from a language point of view.  And since you asked directly..."}}