KDE/kdevplatform/plugins/subversion
dukju ahn
dukjuahn at gmail.com
Sun Jul 29 11:50:53 UTC 2007
> > > > But why is the #define too bad?
> > >
> > > Because they are unneeded and IMHO its just the wrong tool for the job.
> > > enum is a far better tool.
> >
> > It's needed for uniformity. Suppose that in somewhere we use
> > VcsJob::Add and in other place we use SvnJob::Info. They are different
> > type. So I can't, at lease, use VcsJob enums directly.
> > I need to redefine every enums in a single type.
>
> AFAIK you can extend the existing VcsJob enum, but I currently am not
> 100% sure how... There may be an example in Qt...
>
> > > > It doesn't do any harm as far as the values are defined correctly.
> > > > What is the benefit if I redefine everything into enum values such as
> > > > SvnJob::commit ..?
> > >
> > > For example: proper typing and type checking by the compiler, not
> > > polluting the global namespace because the enum values would be
> > > "namespaced" by the class name in which they are defined.
> >
> > In point of syntax it is true. But I'm not clear why it should be
> > confined to namespace. Also, the type is regarded just "int". Then
> > there is no problem is typechecking.
>
> Yes there is a problem: You're loosing proper type checking because then
> you can use any int, wether its a properly understood value or not,
> thats the reason to use the enum type instead of the int. If you use the
> enum value the compiler will choke if you pass a non-enum value in.
Well, thanks. I think I need to define new enums for subversion later.
More information about the KDevelop-devel
mailing list