PDA

View Full Version : Is the following function call valid?



Lvl80retpaladin
03-08-2010, 02:50 PM
I'm finding ways to organize my code to make it more readable. If I were to use type a function name and then space a few spaces, and THEN write the parameters, would it be valid? For example:



glClearColor (0.0f, 1.0f, 0.0f, 1.0f);

strattonbrazil
03-08-2010, 05:14 PM
What do you mean by valid? Would it compile? That's easy enough to test. Does it match any coding standards I've ever seen? No. I don't think the whitespace makes it any more legible personally. Just comment your code every five or six lines or describe what you're doing. Your code doesn't need to look like a spreadsheet.

// clear the color and depth buffers for another rendering pass
glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

I feel like there's probably too much else to make your code more legible like intuitive function and variable naming to worry about indentation. Nothing beats comments though, since you can talk in plain English.