Re: [Mlt-devel] const char stuff in mlt++ (possibly mlt)
Brought to you by:
ddennedy,
lilo_booter
From: Mads B. D. <ma...@ch...> - 2008-10-27 07:24:32
|
mandag 27 Oktober 2008 skrev Dan Dennedy: > On Sun, Oct 26, 2008 at 2:20 AM, Mads Bondo Dydensborg > OK. Please > find attached the first try (or step) in removing these for mlt++. > > If you can agree with the approach, the next step will be to change some > > const/non-const in mlt. > > > > Points of note: > > - This patch removes all const->non-const warnings in kdenlive when calling > > mlt++ > > - I have only changed interfaces that are used by Kdenlive - so, I have sort > > of only made explicit what the compiler already does > > hmm, I am not content on leaving it inconsistent, but I suppose I can > take it the rest of the way from your contribution. The reason I have not changed more is solely because I am afraid to break something. When I only change something the compiler complains about, its because I am pretty sure that the usage is probably right, and it really only is because const was not used in the declaration. I don't mind changing "all" char * to const char *, that looks like a const char * to me, if you think that it is safe to do. Please bear in mind, that I have no code that uses the other interfaces in MLT, so I do not know if I break code that relies on Mlt. > > > - If kdenlive passes a const char* to a char* param in mlt++, I have changed > > it to const in mlt++ > > - Where mlt++ passes consts to non-consts in mlt, I have used a const_cast and > > static_cast. I will try to get rid of these in the next revision, but I have > > not looked at mlt yet. If I can't get rid of them, I would assume something > > is wrong in the way kdenlive uses the interface. > > Yeah, this is really ugly, where C++ rears its ugly head IMO: > > static_cast<void*>( const_cast<char*>( id ) ) > > I realize its "politically correct" as far as C++ is concerned, but > this is a binding to a C interface, so a C style cast is highly > justifiable and preferred by me for readability. I will try to remove all these casts for "full" patch (both mlt and mlt++). const_cast and static_cast have the great attribute, that they are highly "grep'able" - but I will change to classic C casts for the full patch. Will work on a new revision soon - done in a couple of days, probably Regards Mads -- Mads Bondo Dydensborg. ma...@ch... If you aim the gun at your foot and pull the trigger, it's UNIX's job to ensure reliable delivery of the bullet to where you aimed the gun (in this case, Mr. Foot). - Terry Lambert, FreeBSD-Hackers mailing list. |