Things college professors say

Pages: 1... 345
closed account (jwkNwA7f)
Usually vlad is very nice from what I have seen and is more then willing to help out beginners and other members with problems.

Yeah, he normally is. He has helped me many times.
closed account (1yR4jE8b)
Just don't put your brace on the same line.
closed account (N36fSL3A)
I know. It's just silly.

And has anyone realize Bjarne's coding style is godawful?
closed account (S6k9GNh0)
Actually, I adopted most of how Stroustrup codes. I like it, it's compact and clear (although, I don't put braces on the same line when using C++ because things like initializer lists are too common and becomes confusing).
closed account (N36fSL3A)
I was thinking of another person, never mind. His coding style is pretty cool, minus the bracket on the starting line.
I actually prefer the open brace on the same line. There's no logic or reasoning behind it. It's just more asthetically pleasing to me.
Since this thread is off topic anyway I want to come back to something someone posted very early in this discussion: Placement of the asterisk in pointer declaration.

I just recently taught a colleague some C++ and I stumbled upon his question why I put the '*' next to the type name, like:

int* pCnt;

My explanation was: 'pCnt' is the "identifier" and it has the type "pointer to integer", therefore: 'int*'.

I always thought it was logical, but people seem to prefer:

int *pCnt;

How do you explain that? '*pCnt' is the "identifier that is a pointer" and it has the type "integer"?
closed account (1yR4jE8b)
The reason I usually get, is when you get declarations like:

int *foo, bar;

It's easier to tell which one is a pointer (foo) and which one isn't (bar).

I think this reason is silly, personally. Declaring variables of two different types in one line should be discouraged:

1
2
int* foo;
int bar;
closed account (z05DSL3A)
How do you explain that? '*pCnt' is the "identifier that is a pointer" and it has the type "integer"?


1
2
3
4
    int* ptr_1;  // ptr_1 is a variable of type pointer to an integer 
    int *ptr_2;  // ptr_2 is a variable of type pointer to an integer
    int * ptr_3; // ptr_3 is a variable of type pointer to an integer
    int*ptr_4;   // ptr_4 is a variable of type pointer to an integer 
Last edited on
I prefer int *pCnt; because of this:
1
2
3
int a = 'a';
int *b = &a;
int c = *b;
Read:
The dereference is applied to the variable and so is the reference
closed account (z05DSL3A)
What about a constant pointer to an int?
As in int * const b = &a;, rather than the versions with const on the left of *?
closed account (3qX21hU5)
In reality I think it really doesn't matter because most programmers won't get confused by the asterisk being by the type or the other way around. Only beginners might be confused about it when they are just getting familiar with the syntax.

So it basically comes down to personal preference (IE Whatever you like the look of more, or what makes more sense to you), or your projects coding standards if you are working in a group.

So if you put it like this int* p1; or like this int *p1; it really doesn't matter to me.


I think there is much more serious things in C++ then where we put out asterisks on pointers. For example why the hell aren't they using @ for the reference operator ;p
Last edited on
closed account (z05DSL3A)
keskiverto,

Yes. It was aimed at the people that like the int *b. This is one of the reasons I don't like this 'style'.
Last edited on
And has anyone realize Bjarne's coding style is godawful?

I think it's a little ridiculous when a nube like Fredbill is calling Bjarnes style godawful.

And Vlad thinks people stupidly follow "well known idiots like Bjarnes", and adopt bad styling choices like using bracket on starting line. That's pretty ridiculous considering that blindly following Vlad's non-existent logical argument why it's bad would be even stupider.

But what is really ridiculous is that somehow people think this is an important issue, as if your code will be cleaner and prettier in an objective way using a, or b; especially when it comes from nubes who write horribly inelegant/ugly code anyways.

Talk about delusions of grandeur.
Last edited on
I havent developed the eyes to spot a professionals coding style as being god awful.

It could be perfection itself but people repeat this shit to sound like they know what they are talking about, even professionals with many years experience.
Last edited on
I would not be surprized at all if Bjarne's style of coding is terrible. He has no need to prove himself nor impress anyone.

I try like hell to code in such a way that a beginner could follow my logic, but should Bjarne? He could very well be like, screw you and just try to keep up, and we'd all eat it. He is the man after all.
Last edited on
I try like hell to code in such a way that a beginner could follow my logic, but should Bjarne?

He should, and he does. That's what he's paid to do.
closed account (N36fSL3A)
I think it's a little ridiculous when a nube like Fredbill is calling Bjarnes style godawful.
I wrote:
I was thinking of another person, never mind. His coding style is pretty cool, minus the bracket on the starting line.


I was thinking about someone else. I'm not a 'nube'! D:

Well probably compared to you. At least I'm not a script kiddie.
Topic archived. No new replies allowed.
Pages: 1... 345