| Off Topic > Off Topic |
| Programming Megathread |
| << < (125/241) > >> |
| Headcrab Zombie:
--- Quote from: Ravencroft· on May 03, 2016, 12:44:35 PM ---That's odd. My lecture notes say to have parentheses around the return variable. There's even parentheses on it on the example code snippets. --- End quote --- I guess parenthesis are usually allowed and usually works. But it's not really standard, and not required. Probably better not to, as some IDEs/compilers/languages may not allow it |
| ZSNO:
--- Quote from: Headcrab Zombie on May 03, 2016, 03:07:53 PM ---I guess parenthesis are usually allowed and usually works. But it's not really standard, and not required. Probably better not to, as some IDEs/compilers/languages may not allow it --- End quote --- I'm pretty sure return parenthesis are C style |
| McJob:
When I was young and new to coding in C, the documentation/tutorial stuff I was reading had me use parenthesis. In C, C++ and C# they all allow parenthesis after return for grouping items together. Nowadays I'll only use them if I need to cast my math into the return type. |
| Zeblote:
--- Quote from: Ravencroft· on April 18, 2016, 08:23:57 PM ---anyone know how to disable the auto formatting in visual studio? i bought it today --- End quote --- you what? are you aware there's a free version with no restrictions? https://www.visualstudio.com/products/visual-studio-community-vs |
| Foxscotch:
--- Quote from: McJob on May 03, 2016, 03:52:48 PM ---Nowadays I'll only use them if I need to cast my math into the return type. --- End quote --- why? return 1 + 1 will work just as well as return(1 + 1) I don't really care what you use, but you should keep it consistent... edit: wait, that's not what you mean I don't know what the syntax is for type casting in any of those languages, but I don't think it will require you to use parentheses either |
| Navigation |
| Message Index |
| Next page |
| Previous page |