On Wed, May 18, 2011 at 9:45 PM, Warren Young <mysqlpp@stripped> wrote:
> On May 18, 2011, at 9:27 PM, Adrian Cornish wrote:
>
>> Index: lib/ssqls.pl
>> ===================================================================
>> --- lib/ssqls.pl (revision 2690)
>> +++ lib/ssqls.pl (working copy)
>> @@ -499,8 +499,9 @@
>> sql_compare_define_##CMP(NAME, $parmC)
>> sql_construct_define_##CONTR(NAME, $parmC)
>> static const char* names[];
>> + static const size_t field_count = NAME##_NULL;
>
> Instead of defining the new one in terms of the old, why not just make this the new
> constant, and replace all the other ones? ssqls_NULL isn't nearly as C++ish as
> ssqls::field_count.
I tried quickly to remove the enum - but ssqls_NULL is used internally
in some places like:
$create_list .= " if (i$j == NAME##_NULL) return;\n" unless $i == 1;
Also even though it isnt documented - maybe someone is using it. (Not
sure if that is an issue)
I prefer 'ends' to enums (which is basically index for names[])
With a bit more work I can probably remove the ssqls_NULL and replace
with the ssqls::field_count if people prefer.
>
>> - const char* const table() const
>> + const char* table() const
>
> I guess it makes sense that the second const can have no useful effect. It
> would be different if it were returning a reference to the internal C string pointer.
Agree - but I get lots of warnings in my projects from this - its a
bit like "const int foo()" const by val makes no sense
Adrian