RE: C++ program 05-14-2014, 11:58 PM
#10
(05-14-2014, 04:29 AM)dropzon3 Wrote: Sure it does, if say "usinging namespame ..." was significantly faster than std:: then it would be advisable to always use that so performance certainly should be considered...in this case its meaningless but still considered.
What is 'usinging namespame' exactly? :S
... Performance, as I'm trying to tell you, is out of the question. OP posted about that line of code, not programming in C++ in general. There are bad things that follow as a result of that line of code, but no effects to performance, therefore, there is no such comparable thing as to coding style or performance here. You've written out a whole bunch of off topic and very irrelevant stuff to what OP was asking.
His question was on this line of code, you said yourself it's meaningless, so how in the world would it still be considered? Performance isn't even affected... That's like testing water for flammable characteristics when you already know it's properties... You made my point for me.
(05-14-2014, 04:29 AM)dropzon3 Wrote: Coding style is certainly important also in decided which form is better because a clean coding style is better than a messy one.
'using namespace std;' is not related to coding style... Preference maybe, but that's not the same as coding style. Style has absolutely nothing to do with what declarations you make, but rather how you name your variables, what design paradigms you use, etc...
(05-14-2014, 04:29 AM)dropzon3 Wrote: I take the question to be asking in general 'which is better' not just which is better for this particular individual case. I think that is where we differ.
There's no difference in any case. I'm just pointing out that the risk is or can be less severe depending on where you use it. Do you understand what happens when you write that line in your source code or not? He specifically asked which was better to be using and why. You didn't answer anything.
(05-14-2014, 04:29 AM)dropzon3 Wrote: Sure, most issues are minor compared to some larger issue...that doesn't mean you can't consider keeping your code readable to someone else even if other issues are more pressing. Surely any code is perfectly fine if it works...
You're not a programmer are you? First, you started to argue about coding style and clean and concise code, now you're saying any code is fine if it works? You're also arguing about clean code and performance which has no bearing to the original question in this case over the real issues that any half-experienced C++ programmer would know about.. You didn't point any of them out.
(05-14-2014, 04:29 AM)dropzon3 Wrote: Build good habits from the start. Imo having a consistent style across big and small personal projects is a good thing. Write all code as if its going to become big and wild and maintained for a long time. Nothing wrong with following best practices even in the small scale.
You don't even know what good habits are because you're not a C++ programmer. You can't answer OP's question for him. This isn't a philosophical language, and C++ has many nuances that most don't understand at all.
(05-14-2014, 04:29 AM)dropzon3 Wrote: Build good habits from the start. Imo having a consistent style All that said I'm not a C++ dev; I rather dislike the language so I don't know what industry best practices are but using the namespace explictly seems like it would be a good practice. Just my two cents.
"seems like"? :S
You're completely wrong btw.. I don't know why you're posting advice in this section when you have no idea about what that line of code does or what downsides it has when a programmer uses it over explicitly writing out the namespace specifiers...
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

![[+]](https://sinister.li/images/modern/collapse_collapsed.png)