swiftlang/swift

[SR-14941] Introduce compiler warning for leading-zero octal notation

Open

#57.283 aperta il 19 lug 2021

Vedi su GitHub
 (13 commenti) (0 reazioni) (1 assegnatario)Swift (10.719 fork)batch import
good first issueimprovement

Metriche repository

Star
 (69.989 star)
Metriche merge PR
 (Merge medio 8g 17h) (510 PR mergiate in 30 g)

Descrizione

Previous ID SR-14941
Radar rdar://problem/22123688
Original Reporter eaigner (JIRA User)
Type Improvement
Votes 0
Component/s
Labels Improvement, StarterBug
Assignee None
Priority Medium

md5: 639a9bd96ac9c3918c5433098fa9ad29

Issue 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?"

Guida contributor