Em 11/10/2014 09:20, "Rafael Roquetto" <[email protected]> escreveu:
>
> On Fri, Oct 10, 2014 at 09:26:11PM -0300, Tomaz Canabrava wrote:
> > On Fri, Oct 10, 2014 at 6:35 AM, Milian Wolff <[email protected]>
wrote:
> >
> <snip>
> >
> > It's too error prone regarding typos.
>
> This is easily solved by using constants instead of string literals.
>
>  const QLatin1String SettingsGroup("blah");
>  const QLatin1String WidthKey("width");

It's not, as a string is not group aware.

>  KConfig c;
>  KConfigGroup g = c.group(SettingsGroup);
>  g.setValue(WidthKey, 10);

KConfigGroup other = c.group(OtherSettings)
Other.setValue(WrongKeyForThisGroup);

>  //  otherfile
>  Kconfig c;
>  KConfigGroup g = c.group(SettingsGroup);
>  g.value(WidthKey);
>
>
> How do you intend to fix string literal typos? IMHO compile-time checks
are
> better than run-time checks in these cases.

They are much better, agreed, but I plan to add run time checks first since
its easier to do, and in the future add a new binary to check for settings
Inconsiatencies based on a schema.

> Cheers,
> Rafael
>
> --
> Rafael Roquetto | [email protected] | Software Engineer
> Klarälvdalens Datakonsult AB, a KDAB Group company
> Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
> KDAB - Qt Experts - Platform-independent software solutions
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to