Comments (3)
Hi,
You where the last one i where expecting to see when opening this Issue, glad to see you caring about your Projects even after soo many Years <3
There is no need for Semicolons since the default Compiler Value is 0. I still place it behind everything except for: if/else/case/switch/function names/block lines like { } - just because, there is no good Reason, just me being Autistic ^^, but youre right, i probably should remove them from all 1.8+ Projects
I try to make an consistent Codestyle, ive documented the basics over my other Project > https://github.com/DJPlaya/Kigen-AC-Redux/blob/master/CONTRIBUTING.md
When comparing the original V1.73 Code with the latest Redux Commit, i can see the following Changes which i will ref. from another Project for easy Access:
- https://github.com/DJPlaya/Cheat-Acid/blob/master/GRAB/FFC/ff_toolfuncs.sp#L107 - The if Bracket isent opened, this would mean only the next Line is run by that which will be the do Block, i guess the while is part of it but this makes me wonder a bit, ime always trying to make either 1 Line if Blocks or use Brackets after it?
- https://github.com/DJPlaya/Cheat-Acid/blob/master/GRAB/FFC/ff_toolfuncs.sp#L114 - In this Part, the different Checks within the if block are separated to multiply Lines, i merged it to a single Line because of automatic Line breaks and modern Programming Software being able to detect the Statements.
- https://github.com/DJPlaya/Cheat-Acid/blob/master/GRAB/FFC/ff_toolfuncs.sp#L134 - Ime not sure why you have used an Semicolon after the while? Could you explain whys it belongs there?
- https://github.com/DJPlaya/Cheat-Acid/blob/master/GRAB/FFC/ff_toolfuncs.sp#L135 - Thanks for reporting this, this is definitely an Mistake i made while converting the original Syntax and it dident got caught by the Compiler because the str Variable is used correctly in this Context. Since the while is behind the do, its an head-driven loop, i guess then the while Block was executed after every full do run. It will be fixed in the next Update
from forlix-floodcheck-redux.
I admit I may have an unusually compact coding style and I'm coming from C/C++ (which is my favorite language), that should give you some perspective. That's also why I embraced the semicolon in all of my SourceMod projects because it gives you more freedom and in my opinion allows you to write more concise and more readable code. I often split up conditional statements onto multiple lines instead of putting everything in a single line - the latter to me just looks cluttered and harder to read. As the code was originally written with mandatory semicolons enabled, there had to be a semicolon after the "while", because the "while" was part of the "do" block.
As a matter of fact, I believe I actually wrote this function in Visual C++, using its debugger to step through the code. Once it was complete and working I simply copied it over to my plugin, replacing just the C-style declarations and function prototypes. Nowadays and to my delight SourceMod even uses the C-style declarations which would have made this even easier.
Your code definitely looks better now, although I'd remove the empty line 185 just to make it clear that the "while" is part of the block above it (if your styling guidelines permit). That's the advantage of semicolons - looking at your code now, one might come to the conclusion that the "while" actually loops the assignment beneath it (with an awkward empty line in between). With semicolons you would start to wonder if it was just an empty loop (rare) or maybe look up to realize it is part of a "do...while".
Hopefully that answers your questions. By the way I am not sure how experienced a programmer you are, but your rule of not placing a semicolon after those things you mentioned should be rooted deeper than "no good reason". The semicolon (in C, and in SourceMod, if enabled) is not just something put at the end of a line for fun. It is used to terminate a statement. If you were to write "if(...); something" then "something" would always be done because it would not be part of the "if".
Take a look at the Wiki for SourcePawn (that's what the language for SourceMod plugins is actually called):
https://wiki.alliedmods.net/Introduction_to_SourcePawn_1.7#While_Loops
Note that they use semicolons in all the examples there and I also warmly recommend you do too. It helps a lot to avoid errors and ambiguities in the code if you use "#pragma semicolon 1". The compiler warnings should be your friend, not your enemy. You would have been made aware of this issue by the compiler and could have resolved it on your own.
from forlix-floodcheck-redux.
I am aware of the previous Usage of the Semicolon, its kind of a Leftover from converting since ime still learning with my Projects.
I mainly left it for readability since many Coders dont like the 1.7/1.8 Change, but its a good Idea to use it for catching some typo Errors.
from forlix-floodcheck-redux.
Related Issues (10)
- Add Option to mute and kick when Chat spamming instead of banning
- Add immunity for privileged players
- Add Chatflood Protection for more Games HOT 2
- Add SB 2.0 and SB++ Support
- Convar Improvement
- Make Builds for 1.8/.19 and 1.10
- Replace the Message Output Defines with the SM Translation System
- Fill the Wiki with useful Stuff
- add new Optional: MaterialAdmin HOT 27
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from forlix-floodcheck-redux.