Sign in to follow this  
TrentonK

My OLD Syntax

Recommended Posts

unexpectedly    120

That's awesome. :) And a great read. It reminds me of my expectations: php is a chainsaw to get the job done and I don't really expect much from it. I expect more from C and C++ and they demand more of my thought to work correctly. (so, I'm spoiled by php)

 

I really like that dude said to go learn python. Always have been meaning to. Seeing the reference and reading some led to my big chuckle for the day:

Go learn Lisp. I hear people who know everything really like Lisp.

 

Share this post


Link to post
Share on other sites


Two things I miss the most from PHP: === operator and all variables needing to start with $. The $ thing makes it easier for me to see my own variables in the other mess of logic. And the === identity is true only if value and type match. So you can do a ===0 or !==0 and not really worry about accidental 1/0 true false problems.

By general rule, if a language has === and !==, that means somebody got the design of the language horribly wrong with == and != (I can see doing implicit casting with integers and/or floats, but as soon as any other type combinations are involved comparisons should always return false).

 

Also the $ thing has an advantage you didn't mention: they're guaranteed to not clash with keywords, because they never start with $. That's extremely useful in the long run, albeit it looks somewhat hackish. Shame PHP only does it for variables and not for all identifiers.

Share this post


Link to post
Share on other sites
ill    320

That's funny.  I consider that a great style.  Also this is the style at Microsoft, and Epic.

 

I only switched to having the opening curly brace on the same line because I wanted to be consistent with others on a team I was on.  Overall I think putting it on the next line is the most flexible and doesn't require weird special cases like when you start indenting the parameters list.

Share this post


Link to post
Share on other sites

Reading the comments there reminds me of people who said that if you aren't using camel case you're actively boycotting other programmers by making identifiers less readable... I actually find all lowercase to be more readable than camel case (although if you use all lowercase then you must use underscores, otherwise yes, it's an unreadable mess).

 

Which reminds me, with my current style things go like this:

  • Identifiers: lowercase
  • Custom types: camel case
  • Constants: uppercase

How would it be with camel case for identifiers? Like this? (going by the Windows API, which does exactly this)

  • Identifiers: camel case
  • Custom types: uppercase
  • Constants: uppercase

Yeah, not hard to see the issue there, constants and types look the same under that convention. Sure, somebody will argue that smart syntax highlighting should take care of that, but you don't always have that available, and you shouldn't rely on it being available either, especially if you're going to be sharing the code (and you should program like you will!).

Share this post


Link to post
Share on other sites
skarab    1020

Using python syntax on C++ project is a nice thing to experience, specially to get cool state machines.

We need to add --ignore--brackets option to GCC, enabled on default settings in the next release (as usual).

Share this post


Link to post
Share on other sites
Techkid    116

Well when I'm too lazy to make my code look nice I just press CTRL + SHIFT + F in eclipse and it automatically formats my code. Try it if you use eclipse I.D.E.

Share this post


Link to post
Share on other sites
mhagain    13430

Checking the OP's profile, and re-reading the post itself, it seems at least possible that he just came to troll or incite a flamewar over brace style.  It's quite a credit to this community that it didn't happen.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this