Skip to main content

Timeline for Event scheduler in C

Current License: CC BY-SA 3.0

5 events
when toggle format what by license comment
Mar 25, 2016 at 5:11 comment added deamentiaemundi @Insane If you get no warning than either size_t is a signed int or the warning-level of your compiler is not high enough. The problems with casting are as described, so if you know exactly what you are doing you can do it, but you shouldn't do it as a beginner. "The types used for size_t and ptrdiff_t should not have an integer conversion rank greater than that of signed long int unless the implementation supports objects large enough to make this necessary." (ISO 9899-2011 in 7.19.4) From my experience: any "unless" in a standard is a source of trouble ;-)
Mar 25, 2016 at 4:41 comment added Insane Yes, it's not casted because I didn't get any warnings. I don't know why but, when used for comparing like for (int i = 0; i < strlen ...) I get no warnings. Why is it bad to cast, though? I understand I can just use size_t as the data type for the counter but what's not good about casting size_t to int?
Mar 25, 2016 at 4:38 comment added deamentiaemundi @Insane re. size_t: it is not casted in your code. It is also not necessary nor good to cast in those cases, just use for(size_t i=0 ...) directly. Just don't forget that size_t is most probably unsigned, so something in the line of size_t i = 123 ... if(i>=0){...}) might get you in trouble (but it should also get you a warning from the compiler).
Mar 25, 2016 at 4:30 comment added Insane All warnings are on, and when I get a warning about size_t I always cast appropriately (neither on gcc or Visual Studio do I get a warning). Possibly because I'm only comparing. And deleteEvent is just the easiest term to use. I know it's not actually deleting. Good points otherwise :)
Mar 25, 2016 at 4:23 history answered deamentiaemundi CC BY-SA 3.0