News for hackers. Stuff that matters.
Re:Git's list of banned C functions by kab_al_ashraf on Thursday March 04, 2021 @09:56PM (#26351983)
> You can work yourself into some weird corners because of how permissive the language is, where in a (strongly) typed language, the complier just says no.

Could you share an example?

Re:Git's list of banned C functions by blahedo on Thursday March 04, 2021 @11:08PM (#26352563)
Here's one my (intro programming, non-major) students have just been tripping over this week:

  if word == "this" or "that":
      ...
Not an error, always runs. Very mysterious to a beginner. (Shared with C/C++) Another one:

  counter = "0"
  for thing in things:
      if matches(thing):
          counter += 1
The error is in the init, by someone who is overzealous with their quoting, but the error is reported, as a runtime error, on the attempted increment, which throws a TypeError and helpfully tells them "must be str, not int", and of course I know exactly why it's reporting the problem there and why it's giving that error, but it's a bit confusing to the newbie programmer and it doesn't even turn up until they actually test their code effectively, which they are also still just learning how to do.