c++ - What does this naming convention for headers refer to? -


i studying include guards in c++ , came across naming convention wikipedia:

creatorsname_yyyymmdd_hhmmss 

i timestamp say

#ifndef creatorsname_yyyymmdd_hhmmss

#define creatorsname_yyyymmdd_hhmmss

#endif

then how compiler know headername.h ?

it's convenient way store documentation person wrote module , when, guarantees uniquness of guard(through date), , provides additional information others referencing module. particularly if believe there problem it's corresponding implementation, have write to. otherwise, creator of module can forget add in documentation are.

#ifndef chris_20140807_011555  #define chris_20140807_011555  struct foo {     int member; };  #endif /* chris_20140807_011555 */ 

alternatively, this, doesn't provide additional information , adding documentation @ top easy forget.(though honest, should become habbit, , should not forgotten). but, still motivation such practices, despite option below being more used.

/* * author: chris * date: july 7, 2013 * * these comments easy forget */ #ifndef filename_h #define filename_h  struct foo {     int member; };  #endif /* filename_h */ 

this:

#ifndef aaaa  #define aaaa  struct foo {     int member; };  #endif  

and

#pragma once  struct foo {     int member; }; 

all of these code snippets accomplish exact same thing.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -