Current version

v1.10.4 (stable)

Navigation

Main page
Archived news
Downloads
Documentation
   Capture
   Compiling
   Processing
   Crashes
Features
Filters
Plugin SDK
Knowledge base
Donate
Contact info
Forum
 
Other projects
   Altirra

Search

Archives

01 Dec - 31 Dec 2013
01 Oct - 31 Oct 2013
01 Aug - 31 Aug 2013
01 May - 31 May 2013
01 Mar - 31 Mar 2013
01 Feb - 29 Feb 2013
01 Dec - 31 Dec 2012
01 Nov - 30 Nov 2012
01 Oct - 31 Oct 2012
01 Sep - 30 Sep 2012
01 Aug - 31 Aug 2012
01 June - 30 June 2012
01 May - 31 May 2012
01 Apr - 30 Apr 2012
01 Dec - 31 Dec 2011
01 Nov - 30 Nov 2011
01 Oct - 31 Oct 2011
01 Sep - 30 Sep 2011
01 Aug - 31 Aug 2011
01 Jul - 31 Jul 2011
01 June - 30 June 2011
01 May - 31 May 2011
01 Apr - 30 Apr 2011
01 Mar - 31 Mar 2011
01 Feb - 29 Feb 2011
01 Jan - 31 Jan 2011
01 Dec - 31 Dec 2010
01 Nov - 30 Nov 2010
01 Oct - 31 Oct 2010
01 Sep - 30 Sep 2010
01 Aug - 31 Aug 2010
01 Jul - 31 Jul 2010
01 June - 30 June 2010
01 May - 31 May 2010
01 Apr - 30 Apr 2010
01 Mar - 31 Mar 2010
01 Feb - 29 Feb 2010
01 Jan - 31 Jan 2010
01 Dec - 31 Dec 2009
01 Nov - 30 Nov 2009
01 Oct - 31 Oct 2009
01 Sep - 30 Sep 2009
01 Aug - 31 Aug 2009
01 Jul - 31 Jul 2009
01 June - 30 June 2009
01 May - 31 May 2009
01 Apr - 30 Apr 2009
01 Mar - 31 Mar 2009
01 Feb - 29 Feb 2009
01 Jan - 31 Jan 2009
01 Dec - 31 Dec 2008
01 Nov - 30 Nov 2008
01 Oct - 31 Oct 2008
01 Sep - 30 Sep 2008
01 Aug - 31 Aug 2008
01 Jul - 31 Jul 2008
01 June - 30 June 2008
01 May - 31 May 2008
01 Apr - 30 Apr 2008
01 Mar - 31 Mar 2008
01 Feb - 29 Feb 2008
01 Jan - 31 Jan 2008
01 Dec - 31 Dec 2007
01 Nov - 30 Nov 2007
01 Oct - 31 Oct 2007
01 Sep - 30 Sep 2007
01 Aug - 31 Aug 2007
01 Jul - 31 Jul 2007
01 June - 30 June 2007
01 May - 31 May 2007
01 Apr - 30 Apr 2007
01 Mar - 31 Mar 2007
01 Feb - 29 Feb 2007
01 Jan - 31 Jan 2007
01 Dec - 31 Dec 2006
01 Nov - 30 Nov 2006
01 Oct - 31 Oct 2006
01 Sep - 30 Sep 2006
01 Aug - 31 Aug 2006
01 Jul - 31 Jul 2006
01 June - 30 June 2006
01 May - 31 May 2006
01 Apr - 30 Apr 2006
01 Mar - 31 Mar 2006
01 Feb - 29 Feb 2006
01 Jan - 31 Jan 2006
01 Dec - 31 Dec 2005
01 Nov - 30 Nov 2005
01 Oct - 31 Oct 2005
01 Sep - 30 Sep 2005
01 Aug - 31 Aug 2005
01 Jul - 31 Jul 2005
01 June - 30 June 2005
01 May - 31 May 2005
01 Apr - 30 Apr 2005
01 Mar - 31 Mar 2005
01 Feb - 29 Feb 2005
01 Jan - 31 Jan 2005
01 Dec - 31 Dec 2004
01 Nov - 30 Nov 2004
01 Oct - 31 Oct 2004
01 Sep - 30 Sep 2004
01 Aug - 31 Aug 2004

Stuff

Powered by Pivot  
XML: RSS feed 
XML: Atom feed 

§ Don't code at 1am, round two

Found this in VirtualDub's render path while debugging some issues with the input driver API. Do you see the bugs? I spotted the first one immediately, but almost posted a new test release to the forums before spotting the second.

 frameInfo.mRawFrame      = stream_frame;
 frameInfo.mTimelineFrame = target_frame,
 frameInfo.mDisplayFrame  = display_frame;
 frameInfo.mTimelineFrame = timeline_frame;

Comments

Comments posted:


You have a comma instead of a semi-colon on the second line and you are setting mTimelineFrame twice. Took me a while to see the second one :-)

Paul - 07 10 07 - 21:20


I noticed the double mTimelineFrame immediately, but it took me a while to find the comma bug.

The interesting question now is: which one did you spot immediately, and which one took you longer?

Darkstar - 08 10 07 - 04:09


You've assigned both target_frame and timeline_frame to mTimelineFrame. There may also be an error in assigning stream_frame to mRawFrame, but that depends on what your code is doing.

I didn't spot the comma until after reading through the other comments. That's something that either the IDE will show through strange highlighting, or the compiler will explode messily on.

Thomas (link) - 08 10 07 - 06:13


Thomas: No, that comma thing is actually perfectly valid C(++). The only thing the compiler might complain about is that target_frame is accessed but discarded.
(Oh, and BTW, I didn't spot it until cheati^Wreading the other comments, too :)

KeyJ (link) - 08 10 07 - 12:54


actually,
the "mTimelineFrame" people were having a "buy-one-get-one-free" sale.

roseman - 09 10 07 - 11:01


@KeyJ: It is?
/me looks up comma in MSVC docs
Apparently it is. If I'm reading the docs right, then with the code shown it'll work as intended with no side effects. Looking at the docs, it looks like one could replace most semicolons with commas and have programs still work.

Thomas (link) - 09 10 07 - 16:55


If you were aiming at consistency in your functions and properties names, I'd say that frameInfo.mRawFrame should reference something called raw_frame, not stream_frame - or that the property should be renamed frameInfo.mStreamFrame.

So maybe the second bug is a mis-reference.

If the name change is voluntary, then I don't know.

Mitch 74 - 12 10 07 - 09:41


omg, what can i comment? they all talking about what the hell that comma was doing there? well, i dont know, caz i am not a programmer, I only want a good optimized and improved virtualdb that guy is making there.
BTW: i posted this caz i read at this page: |please keep comments on-topic for this entry"

balad - 13 10 07 - 16:26


Nah, the comments are fine -- this entry's more about coding than VirtualDub itself. The comma is amusing because it's definitely not what I had intended and means something different to the compiler, but it just happens to work.

Phaeron - 13 10 07 - 16:38


I spotted the missing semi-colon immediately, mTimelineFrame looked suspicious but I dont the API that well..

Councils Ov Therion - 19 10 07 - 22:57


Eh, you should have seen me debugging some code compiled with Intel compiler, which refused to set global variables (of type double) to their initial values. Actually, it did initialize them but the values were randomly wrong.

I submitted an issue but their developer couldn't reporduce the issue and he sent me this code example saying that someone else reported it and that it looks similar to my issue:

double somefunc(double a)
{
return a * 1.18;
}

Compiler kept optimizing the multiplication out thus always returning what was passed in. I tried it and I was able to reproduce the problem and he was puzzled because he wasn't able to reproduce that one either.

Then I had one of those blinding flashes and the train of thought went like this:

1. a * 1.18 = adding tax (I am from Serbia, tax is 18%)
2. What do I have in common with that person?
3. (slaps forehead) Regional Settings!

It turned out that the compiler was mistakenly honoring regional settings and swapped "." and "," so the code turned into:

return a * 1,18;

I told their developer to change his regional settings to any locale where "." and "," were reversed and lo and behold -- he managed to reproduce the problem.

In my opinion that is the worst kind of bug you can hit -- you can't see it because it is not yours.

Igor (link) - 07 01 08 - 22:11

Comment form


Please keep comments on-topic for this entry. If you have unrelated comments about VirtualDub, the forum is a better place to post them.
Name:  
Remember personal info?

Email (Optional):
Your email address is only revealed to the blog owner and is not shown to the public.
URL (Optional):
Comment: /

An authentication dialog may appear when you click Post Comment. Simply type in "post" as the user and "now" as the password. I have had to do this to stop automated comment spam.



Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.