Re: Avoiding Booleans & Danny Thorpe



John Herbster wrote:
"Andre Kaufmann" <andre.kaufmann.bei@xxxxxxxxxxx> wrote


  CreateFile(cmCreateNew);
is much more readable than
  CreateFile(true);
With the latter one I don't have any clue what's the parameter for.


Which is why I try to code
  CreateFile( {CreateNew}true );
where comment CreateNew will give the reader a hint as
to what the parameter is for.


Good idea, I do that too for functions I cannot change.
But if you are implementing the function, what would be
the benefit of using a boolean parameter and additionally adding it's purpose as comment compared to adding it to the variable name itself ?


--JohnH
.



Relevant Pages

  • Re: Avoiding Booleans & Danny Thorpe
    ... > With the latter one I don't have any clue what's the parameter for. ... CreateFile({CreateNew}true); ... where comment CreateNew will give the reader a hint as ... Prev by Date: ...
    (borland.public.delphi.non-technical)
  • Re: Outlook custom forms
    ... custom form is: ... Under column 'Operation' it says 'CreateFile' and the 'Result' column ... says 'NAME COLLISION' ... clue if those lines are relevant. ...
    (microsoft.public.outlook.program_forms)
  • API Hooking
    ... Anyone has already manage to do a system wide API Hooking. ... I would like to intercept every call to CreateFile .... ...
    (microsoft.public.windowsce.embedded)