Raised This Month: $51 Target: $400
 12% 

Solved loop entitys


Post New Thread Reply   
 
Thread Tools Display Modes
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 11-17-2022 , 20:10   Re: loop entitys
Reply With Quote #41

Quote:
Originally Posted by fysiks View Post
Wow, you just keep going.
"because it is determined at compile time (sizeof is a preprocessor directive/function)."

I don't know if it's an error, but as I showed you above, the size of the array is not determined when it is compiled, it is determined when the function is used, since the size of the array changes, I don't know if this was a lie on purpose, or your years here were useless, whatever the topic is closed, bye

https://forums.alliedmods.net/showpo...4&postcount=33

Last edited by MrPickles; 11-17-2022 at 20:20.
MrPickles is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-17-2022 , 20:20   Re: loop entitys
Reply With Quote #42

I may have worded it incorrectly but it certainly can be determined at compile time (because array sizes are determined at compile time, even constant ones that you hard code into the function arguments). It functions the same regardless of when it's actually evaluated and the difference would be negligible.

I may make mistakes with some of the underlying implementation of the Pawn programming language, I've never claimed to be an expert at that level of the code. I mostly work with the higher level stuff and don't need to worry about these trivial differences.

Regardless, your "100" would probably be considered a magic number.
__________________
fysiks is offline
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 11-17-2022 , 20:24   Re: loop entitys
Reply With Quote #43

Quote:
Originally Posted by fysiks View Post
I may have worded it incorrectly but it certainly can be determined at compile time (because array sizes are determined at compile time, even constant ones that you hard code into the function arguments). It functions the same regardless of when it's actually evaluated and the difference would be negligible.

I may make mistakes with some of the underlying implementation of the Pawn programming language, I've never claimed to be an expert at that level of the code. I mostly work with the higher level stuff and don't need to worry about these trivial differences.

Regardless, your "100" would probably be considered a magic number.
"it can" is very different from what it does, it would have to be an array that never changes its size, in this case no, each time the function is called, the size of the array is obtained, and to work at the "high level "It's rare that someone messes up with little things like this, and no,it is not a magic number that saves you the process of getting the size every time it's called, cause

"A unique value with unexplained meaning "

in this case it does have a meaning, tell you when to stop the loop, and not do unnecessary processing every time the function is called

Last edited by MrPickles; 11-17-2022 at 20:26.
MrPickles is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-17-2022 , 20:39   Re: loop entitys
Reply With Quote #44

Quote:
Originally Posted by MrPickles View Post
no,it is not a magic number that saves you the process of getting the size every time it's called, cause

"A unique value with unexplained meaning "

in this case it does have a meaning, tell you when to stop the loop, and not do unnecessary processing every time the function is called
It is a magic number. All magic numbers have meaning, the point is that it's not explicitly explained in the source code. What is the significance of the number 100? Why did you choose 100?
__________________
fysiks is offline
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 11-17-2022 , 20:42   Re: loop entitys
Reply With Quote #45

Quote:
Originally Posted by fysiks View Post
It is a magic number. All magic numbers have meaning, the point is that it's not explicitly explained in the source code. What is the significance of the number 100? Why did you choose 100?
"All magic numbers have meaning"
eh no, a magic number is "A unique value with UNEXPLAINED MEANING"
https://en.wikipedia.org/wiki/Magic_..._(programming))

"What is the significance of the number 100"
in this case i told u, the meaning is to represent the end of the loop,

"it's not explicitly explained in the source code"
I've said it like 30 times in this post, and if I don't add a // in case someone wants to use my computer and use the file


To have been wrong several times on this topic, are you very insistent, ego or pride? I don't know how far you want to go

Last edited by MrPickles; 11-17-2022 at 20:47.
MrPickles is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-17-2022 , 21:12   Re: loop entitys
Reply With Quote #46

Quote:
Originally Posted by MrPickles View Post
"All magic numbers have meaning"
eh no, a magic number is "A unique value with UNEXPLAINED MEANING"
https://en.wikipedia.org/wiki/Magic_..._(programming))

"What is the significance of the number 100"
in this case i told u, the meaning is to represent the end of the loop,

"it's not explicitly explained in the source code"
I've said it like 30 times in this post, and if I don't add a // in case someone wants to use my computer and use the file
Since when does "explaining it on the internet on some forum" mean the same thing as explicitly explaining it in the code?

Perhaps you didn't notice the adjective in "unexplained meaning". "Unexplained meaning" is not the same as "meaning". As I said, all magic numbers have meaning otherwise they wouldn't be used in the code at all. Making it not a magic number would mean giving it a meaningful variable name, not just a comment in the code.

I didn't ask what was the 100 being used for, I asked what was the significance of choosing that specific number. Why not choose 99 or 101 or 982347? This is what makes it a magic number.

If you replaced your "100" with ENDOFLOOPINRANDOMFUNCTION where ENDOFLOOPINRANDOMFUNCTION is defined as:

Code:
#define ENDOFLOOPINRANDOMFUNCTION 100
then it would no longer be a magic number. And, a bonus, defining it with a preprocessor directive means that it will be just as optimized as hard coding 100 everywhere in your code.


Quote:
Originally Posted by MrPickles View Post
To have been wrong several times on this topic, are you very insistent, ego or pride? I don't know how far you want to go
I may have made some mistakes in some inconsequential details but I'm not wrong on my main points. At this point, it's only because you keep making nonsensical accusations and your obsession with unnecessary optimization.

You a free to stop replying.
__________________
fysiks is offline
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 11-17-2022 , 21:18   Re: loop entitys
Reply With Quote #47

Quote:
Originally Posted by fysiks View Post
Since when does "explaining it on the internet on some forum" mean the same thing as explicitly explaining it in the code?

Perhaps you didn't notice the adjective in "unexplained meaning". "Unexplained meaning" is not the same as "meaning". As I said, all magic numbers have meaning otherwise they wouldn't be used in the code at all. Making it not a magic number would mean giving it a meaningful variable name, not just a comment in the code.

I didn't ask what was the 100 being used for, I asked what was the significance of choosing that specific number. Why not choose 99 or 101 or 982347? This is what makes it a magic number.

If you replaced your "100" with ENDOFLOOPINRANDOMFUNCTION where ENDOFLOOPINRANDOMFUNCTION is defined as:

Code:
#define ENDOFLOOPINRANDOMFUNCTION 100
then it would no longer be a magic number. And, a bonus, defining it with a preprocessor directive means that it will be just as optimized as hard coding 100 everywhere in your code.




I may have made some mistakes in some inconsequential details but I'm not wrong on my main points. At this point, it's only because you keep making nonsensical accusations and your obsession with unnecessary optimization.

You a free to stop replying.
First of all, if it were an "inexplicable meaning" I wouldn't be EXPLAINING the meaning of what it's used for, I think you're also failing in language, second, it's the same as defining the number of a TASKID, only I didn't define it at the beginning of the code, second, I don't have the need to put it in my own file, because the source code will stay on my computer forever, it's not a tutorial, nor a guide, so, again something unnecessary, your failures in "insignificant" details make you fail in your entire point, and it was not a failure, there were several, feel free to stop answering whenever you want

Last edited by MrPickles; 11-17-2022 at 21:19.
MrPickles is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-17-2022 , 21:22   Re: loop entitys
Reply With Quote #48

Quote:
Originally Posted by MrPickles View Post
First of all, if it were an "inexplicable meaning" I wouldn't be EXPLAINING the meaning of what it's used for, I think you're also failing in language, second, it's the same as defining the number of a TASKID, only I didn't define it at the beginning of the code, second, I don't have the need to put it in my own file, because the source code will stay on my computer forever, it's not a tutorial, nor a guide, so, again something unnecessary, your failures in "insignificant" details make you fail in your entire point, and it was not a failure, there were several, feel free to stop answering whenever you want
Making a mistake doesn't make everything I say wrong. Also, I've said it before, you're free to do whatever you want in your own code so you are free to ignore my advice.
__________________
fysiks is offline
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 11-17-2022 , 21:24   Re: loop entitys
Reply With Quote #49

Quote:
Originally Posted by fysiks View Post
Making a mistake doesn't make everything I say wrong. Also, I've said it before, you're free to do whatever you want in your own code so you are free to ignore my advice.
Did you know that the details are the base of a whole point? and you did not make "one mistake" if not several in the whole topic, And if your advice is to do an unnecessary operation every time the function is called, no thanks.

Last edited by MrPickles; 11-17-2022 at 21:27.
MrPickles is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-17-2022 , 21:31   Re: loop entitys
Reply With Quote #50

Quote:
Originally Posted by MrPickles View Post
Did you know that the details are the base of a whole point? and you did not make "one mistake" if not several in the whole topic, And if your advice is to do an unnecessary operation every time the function is called, no thanks.
The mistakes I made didn't negate my original suggestion so no, they did not affect my original suggestion.

Also, as stated before, there are other reasons to do things than just to be a few nanoseconds more efficient.
__________________

Last edited by fysiks; 11-17-2022 at 21:33.
fysiks is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:53.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode