Click here to Skip to main content
15,923,120 members

Survey Results

Who should take responsibility for library function calls?   [Edit]

Survey period: 17 Feb 2003 to 23 Feb 2003

When a library function is called, who is responsible for ensuring that the input data will not cause a program to crash, or worse - be susceptible to a security hole?

OptionVotes% 
The programmer calling the function should ensure the supplied input data is valid.11210.82
The programmer who wrote the library function should ensure that all input data is valid.43341.84
Both library function writer and caller should validate all input data independently.44042.51
Neither - just use try...catch blocks to handle any problems.504.83



 
GeneralWhere are all the C devs? Pin
Shog917-Feb-03 6:56
sitebuilderShog917-Feb-03 6:56 
GeneralRe: Where are all the C devs? Pin
Tim Smith17-Feb-03 8:13
Tim Smith17-Feb-03 8:13 
GeneralRe: Where are all the C devs? Pin
Jeremy Falcon18-Feb-03 12:00
professionalJeremy Falcon18-Feb-03 12:00 
General*I* want to be responsible Pin
Nemanja Trifunovic17-Feb-03 6:24
Nemanja Trifunovic17-Feb-03 6:24 
GeneralWhere are all the C++ devs? Pin
Chris Maunder17-Feb-03 5:59
cofounderChris Maunder17-Feb-03 5:59 
GeneralRe: Where are all the C++ devs? Pin
Shog917-Feb-03 6:54
sitebuilderShog917-Feb-03 6:54 
GeneralRe: Where are all the C++ devs? Pin
Joaquín M López Muñoz17-Feb-03 8:04
Joaquín M López Muñoz17-Feb-03 8:04 
GeneralRe: Where are all the C++ devs? Pin
Philippe Mori22-Feb-03 7:29
Philippe Mori22-Feb-03 7:29 
Joaquín M López Muñoz wrote:
The semantics of CWnds often force the programmer to go trough the sequence construction-creation-destruction. This is IMHO an open hole for errors cause the possibility exists of having a "void" CWnd with no attached HWND. If MFC guys had moved to RAII, CWnds will be created as part of their constructor, elminating the possibility of the error described above. This render the common ASSERT(IsWindow())s unnecesary. "void" CWnds van still be modeled, should the need arise, by having unassigned CWnd pointers.

I think that you are right about RAII but in that particular case, I'm not sure of what should be the solution since allowing no attached HWND allows so simplification of the code and help for RAD...

The C++ solution (and Delphi too) is that the object would hide the fact that the object is created or not by esentially duplicating all properties (for ex. Text, Position,...) so that you can alter them even when the object is not yet created... It works relatively well. I think that .NET Forms would be similar in that area.

Maybe a good solution would be to hide a bit more the user interface by access the data through a class that would knows if a interface object is connected to it (so that the UI is updated when created)... But IMHO, such a solution is probably too complicate for the benefit.

But OTOH since MFC uses DDX for data exchange, maybe it would have been possible to uses RAII exclusively... but then we would have need the possibility to transfer far more property... and also MFC update everything at once and it would cause a lot of overhead...




Philippe Mori
GeneralRe: Where are all the C++ devs? Pin
Leslie Sanford17-Feb-03 8:28
Leslie Sanford17-Feb-03 8:28 
GeneralRe: Where are all the C++ devs? Pin
Jörgen Sigvardsson17-Feb-03 11:29
Jörgen Sigvardsson17-Feb-03 11:29 
GeneralRe: Where are all the C++ devs? Pin
#realJSOP18-Feb-03 2:24
professional#realJSOP18-Feb-03 2:24 
GeneralRe: Where are all the C++ devs? Pin
Anonymous18-Feb-03 5:11
Anonymous18-Feb-03 5:11 
GeneralRe: Where are all the C++ devs? Pin
Stan Shannon18-Feb-03 6:22
Stan Shannon18-Feb-03 6:22 
GeneralRe: Where are all the C++ devs? Pin
walster20-Feb-03 9:46
walster20-Feb-03 9:46 
GeneralRe: Where are all the C++ devs? Pin
compiler21-Feb-03 6:54
compiler21-Feb-03 6:54 
GeneralBoth library function writer and caller should validate all input data independently Pin
ed welch17-Feb-03 1:58
ed welch17-Feb-03 1:58 
GeneralRe: Both library function writer and caller should validate all input data independently Pin
fantastic_mr_fox17-Feb-03 2:12
fantastic_mr_fox17-Feb-03 2:12 
GeneralRe: Both library function writer and caller should validate all input data independently Pin
ed welch17-Feb-03 2:56
ed welch17-Feb-03 2:56 
GeneralRe: Both library function writer and caller should validate all input data independently Pin
Pit M.20-Feb-03 20:33
Pit M.20-Feb-03 20:33 
GeneralRe: Both library function writer and caller should validate all input data independently Pin
chifor20-Feb-03 21:54
chifor20-Feb-03 21:54 
GeneralData validation Pin
Anders Dalvander16-Feb-03 20:14
Anders Dalvander16-Feb-03 20:14 
GeneralRe: Data validation Pin
Tim Smith17-Feb-03 8:08
Tim Smith17-Feb-03 8:08 
GeneralOpen Source Pin
Anders Dalvander17-Feb-03 8:51
Anders Dalvander17-Feb-03 8:51 
GeneralRe: Open Source Pin
Anders Dalvander17-Feb-03 9:07
Anders Dalvander17-Feb-03 9:07 
GeneralRe: Open Source Pin
#realJSOP18-Feb-03 2:21
professional#realJSOP18-Feb-03 2:21 

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.