|Project:||The Open Toolkit library|
Well.I will talk about a bad method singnature.Its name is GL.GetAttachedShaders.Why I say it's bad.First take a look at the definition of all of its overloaded method.
public static void GetAttachedShaders(int program, int maxCount, int count, int obj);
public static void GetAttachedShaders(int program, int maxCount, out int count, out int obj);
public static void GetAttachedShaders(uint program, int maxCount, int* count, uint* obj);
public static void GetAttachedShaders(uint program, int maxCount, int count, uint obj);
public static void GetAttachedShaders(uint program, int maxCount, out int count, out uint obj);
And then let's examine the doc about this function
void GetAttachedShaders( uint program, sizei maxCount,
sizei *count, uint *shaders );
returns the names of shader objects attached to program in shaders. The actual
number of shader names written into shaders is returned in count. If no shaders are attached, count is set to zero. If count is NULL then it is ignored. The maximum
number of shader names that may be written into shaders is speciﬁed by maxCount.
The number of objects attached to program is given by can be queried by calling
GetProgramiv with ATTACHED SHADERS.
So, the parameter count should be a single int.I can understand what is int * count, out int count in the parameter list for .But what the hell append on the method whose count type is int?Is it supposed to return more than one value?So I have to write the code like the following to make it work?
int count=new int;
GetAttachedShaders(program, maxCount, count, obj);
Secondly.I wish the coming version deprecate all the unsafe version function.The safe version method is enough to use.The old method naming idiom using pointers would let us write unsafe code.The protection provided by .NET framework would break.And I think its easy to change the unsafe version method to safe version method.