askbook / csharp-sqlite

Automatically exported from code.google.com/p/csharp-sqlite
Other
0 stars 0 forks source link

Consider using 'out' instead of 'ref' for methods that only return values. #125

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Consider using 'out' instead of 'ref' for methods that only return values to 
avoid misleading compiller error:

Use of unassigned local variable '...'.

For example methods:

sqlite3_open
sqlite3_prepare_v2

can be declared as 

public static int sqlite3_open(string zFilename, out sqlite3 ppDb);
public static int sqlite3_prepare_v2(sqlite3 db, string zSql, int nBytes, out 
sqlite3_stmt ppStmt, ref string pzTail);

without canges in logic. And with a little bit of change to:

public static int sqlite3_open(string zFilename, out sqlite3 ppDb);
public static int sqlite3_prepare_v2(sqlite3 db, string zSql, int nBytes, out 
sqlite3_stmt ppStmt, out string pzTail);

Original issue reported on code.google.com by iyu...@gmail.com on 17 Jul 2011 at 2:24

GoogleCodeExporter commented 8 years ago

Original comment by noah.hart@gmail.com on 22 Jul 2011 at 4:07

GoogleCodeExporter commented 8 years ago
Implemented under 3.7.7.1 w/VFS

Original comment by noah.hart@gmail.com on 23 Aug 2011 at 9:30