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

Update coding guidelines #3785

Merged
merged 2 commits into from
May 14, 2016
Merged

Update coding guidelines #3785

merged 2 commits into from
May 14, 2016

Conversation

thojkooi
Copy link
Contributor

Minor updates to our coding guidelines

Minor updates to our coding guidelines
@thojkooi thojkooi added this to the Ongoing milestone May 12, 2016

### 6.5. Private Variables
All private variables shall be declared in a private array.
All private variables shall make use of the `private` keyword on initalization. When declaring a private variable before initalization, usage of the private array syntax is allowed. All private variables must be either initialized using the private key word, or declared using the private array syntax.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or by using params I guess.
params is not exclusive to the functions arguments, but is sometimes also used in forEach loops (_x params [...]), so it might be worth noting.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or any array really. It's the same as EXPLODE_N_PVT macro was.

@thojkooi
Copy link
Contributor Author

Added both the bit about params usage for arrays and fixed the missing ). Thanks @654wak654.

@commy2
Copy link
Contributor

commy2 commented May 14, 2016

👍

@thojkooi thojkooi merged commit 0373f7b into gh-pages May 14, 2016
@thojkooi thojkooi deleted the update-coding-guidelines branch May 14, 2016 07:42
Bad:
```sqf
private _areAllAboveTen = true; // <- this is bad, because it can be initalized in the if statement
if (call FUNC(myCondition) then {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't think it was worth to mention, but this line is also missing the same closing parenthesis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants