Uploaded image for project: 'Swift'
  1. Swift
  2. SR-14941

Introduce compiler warning for leading-zero octal notation

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: None
    • Labels:

      Description

      I had a bug in my code for quite some time that went by unnoticed, because I didn't realize Swift handled octal numbers differently. Specifically I was making the following call

      mkfifo(path, 0644)
      

      This should obviously read `0o644`, but went by unnoticed, since it just resulted in an elevated user permission.

      It would be great if the compiler could warn in such instances where numbers are typed with leading zeroes, maybe something of the form "Did you mean to write an octal number?"

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            eaigner Erik Aigner
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: