Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing pointer initialisation rule is not useful #140

Open
MatthewHambley opened this issue Feb 9, 2024 · 0 comments
Open

Missing pointer initialisation rule is not useful #140

MatthewHambley opened this issue Feb 9, 2024 · 0 comments
Labels
new rule Add a new rule

Comments

@MatthewHambley
Copy link
Collaborator

It is well known that using the initialiser syntax on local variables makes them "saved" and therefore global scope, i.e. persistent between calls. This is very rarely useful behaviour in modern code.

It was thought that pointers were an exception to this rule but it has become clear they are not. As such the missing pointer initialisation rule is not useful.

It should be replaced by two new rules. One which ensures there are no declaration initialisations. This will prevent any of those implicit globals.

The second is a check that the first thing in the code of any procedure is nullification of any local pointers. This may be spread across one or more nullify statements.

@MatthewHambley MatthewHambley added the new rule Add a new rule label Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new rule Add a new rule
Projects
None yet
Development

No branches or pull requests

1 participant