Click here to Skip to main content
15,879,008 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
David O'Neil23-Aug-20 5:47
professionalDavid O'Neil23-Aug-20 5:47 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
MarkTJohnson23-Aug-20 9:55
professionalMarkTJohnson23-Aug-20 9:55 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? PinPopular
Gary R. Wheeler23-Aug-20 4:34
Gary R. Wheeler23-Aug-20 4:34 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
Greg Utas23-Aug-20 5:08
professionalGreg Utas23-Aug-20 5:08 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
PIEBALDconsult23-Aug-20 5:29
mvePIEBALDconsult23-Aug-20 5:29 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
Greg Utas23-Aug-20 5:39
professionalGreg Utas23-Aug-20 5:39 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
PIEBALDconsult23-Aug-20 5:50
mvePIEBALDconsult23-Aug-20 5:50 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
K Personett24-Aug-20 3:30
K Personett24-Aug-20 3:30 
Not an answer to the original question, however, since this part of the thread is dealing with style/formatting...

Thankful that VS now supports the .editorconfig specification.

I prefer and use 2 space indentation, as to avoid scrolling left and right to be able to read my code.
I also use { and } on their own lines at almost all times, the primary exceptions would be public: inline accessor get methods where exposing the member variable itself would be a bad idea...

ie.
private:
DWORD m_cbAllocated;
public:
inline DWORD get_Allocated() const { return m_cbAllocated; }

In those cases, I find that breaking the method down into multiple lines is overkill.

I also like white spaces after ( and before ) as long as it is not an empty construct. It simply makes it easier for me to read.

ie.

if( ERROR_SUCCESS == ( lRet = RegOpenKeyExA( HKEY_LOCAL_MACHINE, rPF.sPath(), 0, KEY_READ, &hKey ) ) )

In comparisons to constants, I always like to have the constant on the left (see above). This serves two purposes... It is easier to see what I am comparing to without scrolling right past all parameters, and it ensures that a typo (say a missing '=' sign), doesn't compile if comparing to an lValue. (resulting in a bug)

ie.
LONG lRet = RegOpenKeyExA( HKEY_LOCAL_MACHINE, rPF.sPath(), 0, KEY_READ, &hKey );
if( ERROR_SUCCESS = lRet )
{
...
}

Not for everyone, but after doing this for 30+ years, it's what I'm used to, and no employer in their right mind is going to force me to change this late in the game.

Here's the complimentary grain of salt .
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
trønderen23-Aug-20 5:13
trønderen23-Aug-20 5:13 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
PIEBALDconsult23-Aug-20 5:24
mvePIEBALDconsult23-Aug-20 5:24 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
GuyThiebaut23-Aug-20 5:41
professionalGuyThiebaut23-Aug-20 5:41 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
Dan Neely24-Aug-20 2:28
Dan Neely24-Aug-20 2:28 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
David O'Neil23-Aug-20 5:49
professionalDavid O'Neil23-Aug-20 5:49 
PraiseRe: What is the longest programming misconception you've held (that you are aware of)? Pin
CPallini23-Aug-20 22:14
mveCPallini23-Aug-20 22:14 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
Rusty Bullet24-Aug-20 4:55
Rusty Bullet24-Aug-20 4:55 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
PIEBALDconsult23-Aug-20 5:14
mvePIEBALDconsult23-Aug-20 5:14 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
Rick York23-Aug-20 6:31
mveRick York23-Aug-20 6:31 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
Member 1330167923-Aug-20 21:11
Member 1330167923-Aug-20 21:11 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
Josh Gray223-Aug-20 22:11
Josh Gray223-Aug-20 22:11 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
Sander Rossel23-Aug-20 22:09
professionalSander Rossel23-Aug-20 22:09 
PraiseRe: What is the longest programming misconception you've held (that you are aware of)? Pin
CPallini23-Aug-20 22:16
mveCPallini23-Aug-20 22:16 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
Fabio Franco23-Aug-20 22:35
professionalFabio Franco23-Aug-20 22:35 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
Shawn_Eary24-Aug-20 2:58
Shawn_Eary24-Aug-20 2:58 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
obermd24-Aug-20 3:50
obermd24-Aug-20 3:50 
GeneralRe: What is the longest programming misconception you've held (that you are aware of)? Pin
Chaoix24-Aug-20 3:51
Chaoix24-Aug-20 3:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.