regression - mpeg2 interlace/topfield flags not set anymore
Seems something has changed between rev 10908 and current causing the interlaced and field order flag to be set to a wrong value. ffmpeg -i "source.avi" -y -flags +ildct+ilme -bufsize 2000k -b 7600k -maxrate 8000k -top 1 -vcodec mpeg2video output.m2v Bitrate viewer output with ffmpeg rev 10908 : Num. of picture read: 998 Stream type: MPEG-2 MP at ML VBR Resolution: 720*576 Aspect ratio: 1:1 VGA Framerate: 25.00 Nom. bitrate: 8000000 Bit/Sec VBV buffer size: 123 Constrained param. flag: No Chroma format: 4:2:0 DCT precision: 8 Pic. structure: Frame Field topfirst: Yes DCT type: Field Quantscale: Linear Scan type: ZigZag Frame type: Interlaced Same command with rev 11213 : (note frame number, Field topfirst and frame type that are wrong) Num. of picture read: 499 Stream type: MPEG-2 MP at ML VBR Resolution: 720*576 Aspect ratio: 1:1 VGA Framerate: 25.00 Nom. bitrate: 8000000 Bit/Sec VBV buffer size: 123 Constrained param. flag: No Chroma format: 4:2:0 DCT precision: 8 Pic. structure: Frame Field topfirst: No DCT type: Frame Quantscale: Linear Scan type: ZigZag Frame type: Progressive Changing to -top 0 doesn't work either. Tried source avi in DV and raw YUV. Chris.
On Thu, Jan 24, 2008 at 03:46:50PM +0100, christophelorenz wrote:
Seems something has changed between rev 10908 and current causing the interlaced and field order flag to be set to a wrong value.
ffmpeg -i "source.avi" -y -flags +ildct+ilme -bufsize 2000k -b 7600k -maxrate 8000k -top 1 -vcodec mpeg2video output.m2v
bug not reproduceable tff/interlaced flags are correct -> closed/invalid [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Observe your enemies, for they first find out your faults. -- Antisthenes
Michael Niedermayer wrote:
On Thu, Jan 24, 2008 at 03:46:50PM +0100, christophelorenz wrote:
Seems something has changed between rev 10908 and current causing the interlaced and field order flag to be set to a wrong value.
ffmpeg -i "source.avi" -y -flags +ildct+ilme -bufsize 2000k -b 7600k -maxrate 8000k -top 1 -vcodec mpeg2video output.m2v
bug not reproduceable tff/interlaced flags are correct -> closed/invalid
[...]
I have been able to locate the problem and conditions more precisely : All linux builds are ok, it only happens under win32. It doesn't depend on the source material format. It happens with my builds, and other win32 binaries found on the net. After building a bunch or revisions, I found the problem appeared when moving to rev 11142. The only affected file is ffmpeg.c from rev 11117 to 11142 done by michael commented "Fix non-numeric AVOptions." I took rev 11608 and reverted some code to locate the problem and found out that reverting the last change of ffmpeg.c fixes the problem. on svn, last ffmpeg.c line 3278 : for(i=0; i<opt_name_count; i++){ char buf[256]; const AVOption *opt; const char *str= av_get_string(avformat_opts, opt_names[i], &opt, buf, sizeof(buf)); if(str && (opt->flags & AV_OPT_FLAG_ENCODING_PARAM)) av_set_string(oc, opt_names[i], str); } replaced by previous code : (from rev 11117) for(i=0; i<opt_name_count; i++){ const AVOption *opt; double d = av_get_double(avformat_opts, opt_names[i], &opt); if(!isnan(d) && (opt->flags&AV_OPT_FLAG_ENCODING_PARAM)) av_set_double(oc, opt_names[i], d); } Restore the correct operation on interlaced mpegs. Obviously a simple arg parsing problem... but I must say I have no clue why current rev it doesn't work as expected, more specifically under win32... I'll add some debug dump to see what happens, meanwhile if someone has an idea ;-) Chris.
On Sat, Jan 26, 2008 at 12:57:15AM +0100, christophelorenz wrote:
I took rev 11608 and reverted some code to locate the problem and found out that reverting the last change of ffmpeg.c fixes the problem.
on svn, last ffmpeg.c line 3278 : for(i=0; i<opt_name_count; i++){ char buf[256]; const AVOption *opt; const char *str= av_get_string(avformat_opts, opt_names[i], &opt, buf, sizeof(buf)); if(str && (opt->flags & AV_OPT_FLAG_ENCODING_PARAM)) av_set_string(oc, opt_names[i], str); }
replaced by previous code : (from rev 11117) for(i=0; i<opt_name_count; i++){ const AVOption *opt; double d = av_get_double(avformat_opts, opt_names[i], &opt); if(!isnan(d) && (opt->flags&AV_OPT_FLAG_ENCODING_PARAM)) av_set_double(oc, opt_names[i], d); }
This would be much more readable if you provided a (unified) diff. Diego
Diego Biurrun wrote:
This would be much more readable if you provided a (unified) diff.
You're sooo right about this. Humans always make mistakes.... as I did, wrong line number... Here's a diff that fixes the problem on the latest rev. ffmpeg.c =================================================================== --- /ffmpeg/ffmpeg.c (revision 11627) +++ /ffmpeg/ffmpeg.c (working copy) @@ -2887,11 +2887,10 @@ codec = avcodec_find_encoder(codec_id); for(i=0; i<opt_name_count; i++){ - char buf[256]; - const AVOption *opt; - const char *str= av_get_string(avctx_opts[CODEC_TYPE_VIDEO], opt_names[i], &opt, buf, sizeof(buf)); - if(str && (opt->flags & AV_OPT_FLAG_VIDEO_PARAM) && (opt->flags & AV_OPT_FLAG_ENCODING_PARAM)) - av_set_string(video_enc, opt_names[i], str); + const AVOption *opt; + double d= av_get_double(avctx_opts[CODEC_TYPE_VIDEO], opt_names[i], &opt); + if(!isnan(d) && (opt->flags&AV_OPT_FLAG_VIDEO_PARAM) && (opt->flags&AV_OPT_FLAG_ENCODING_PARAM)) + av_set_double(video_enc, opt_names[i], d); } video_enc->time_base.den = fps.num;
On Sun, Jan 27, 2008 at 12:35:24AM +0100, christophelorenz wrote:
Diego Biurrun wrote:
This would be much more readable if you provided a (unified) diff.
You're sooo right about this. Humans always make mistakes.... as I did, wrong line number...
Here's a diff that fixes the problem on the latest rev.
If you could now attach your diff so that your mailer does not mess it up and remove the cosmetics from it, then it would be perfect. Diego
Hi, christophelorenz said:
Michael Niedermayer wrote:
On Thu, Jan 24, 2008 at 03:46:50PM +0100, christophelorenz wrote:
Seems something has changed between rev 10908 and current causing the interlaced and field order flag to be set to a wrong value.
ffmpeg -i "source.avi" -y -flags +ildct+ilme -bufsize 2000k -b 7600k -maxrate 8000k -top 1 -vcodec mpeg2video output.m2v
bug not reproduceable tff/interlaced flags are correct -> closed/invalid
[...]
I have been able to locate the problem and conditions more precisely :
All linux builds are ok, it only happens under win32. It doesn't depend on the source material format. It happens with my builds, and other win32 binaries found on the net.
After building a bunch or revisions, I found the problem appeared when moving to rev 11142.
The only affected file is ffmpeg.c from rev 11117 to 11142 done by michael commented "Fix non-numeric AVOptions."
I took rev 11608 and reverted some code to locate the problem and found out that reverting the last change of ffmpeg.c fixes the problem.
on svn, last ffmpeg.c line 3278 : for(i=0; i<opt_name_count; i++){ char buf[256]; const AVOption *opt; const char *str= av_get_string(avformat_opts, opt_names[i], &opt, buf, sizeof(buf)); if(str && (opt->flags & AV_OPT_FLAG_ENCODING_PARAM)) av_set_string(oc, opt_names[i], str); }
replaced by previous code : (from rev 11117) for(i=0; i<opt_name_count; i++){ const AVOption *opt; double d = av_get_double(avformat_opts, opt_names[i], &opt); if(!isnan(d) && (opt->flags&AV_OPT_FLAG_ENCODING_PARAM)) av_set_double(oc, opt_names[i], d); }
Restore the correct operation on interlaced mpegs.
Obviously a simple arg parsing problem... but I must say I have no clue why current rev it doesn't work as expected, more specifically under win32... I'll add some debug dump to see what happens, meanwhile if someone has an idea ;-)
I compiled SVN-11604 and more than Win32 the problem seems to be MinGW specific: gcc 3.4.4 compiling to Cygwin honors interlacing & -top. gcc 3.4.4 crosscompiling to MinGW doesn't honor them. Regards, V?ctor
"V?ctor Paesa" <wzrlpy at arsystel.com> writes:
Hi,
christophelorenz said:
Michael Niedermayer wrote:
On Thu, Jan 24, 2008 at 03:46:50PM +0100, christophelorenz wrote:
Seems something has changed between rev 10908 and current causing the interlaced and field order flag to be set to a wrong value.
ffmpeg -i "source.avi" -y -flags +ildct+ilme -bufsize 2000k -b 7600k -maxrate 8000k -top 1 -vcodec mpeg2video output.m2v
bug not reproduceable tff/interlaced flags are correct -> closed/invalid
[...]
I have been able to locate the problem and conditions more precisely :
All linux builds are ok, it only happens under win32. It doesn't depend on the source material format. It happens with my builds, and other win32 binaries found on the net.
After building a bunch or revisions, I found the problem appeared when moving to rev 11142.
The only affected file is ffmpeg.c from rev 11117 to 11142 done by michael commented "Fix non-numeric AVOptions."
I took rev 11608 and reverted some code to locate the problem and found out that reverting the last change of ffmpeg.c fixes the problem.
on svn, last ffmpeg.c line 3278 : for(i=0; i<opt_name_count; i++){ char buf[256]; const AVOption *opt; const char *str= av_get_string(avformat_opts, opt_names[i], &opt, buf, sizeof(buf)); if(str && (opt->flags & AV_OPT_FLAG_ENCODING_PARAM)) av_set_string(oc, opt_names[i], str); }
replaced by previous code : (from rev 11117) for(i=0; i<opt_name_count; i++){ const AVOption *opt; double d = av_get_double(avformat_opts, opt_names[i], &opt); if(!isnan(d) && (opt->flags&AV_OPT_FLAG_ENCODING_PARAM)) av_set_double(oc, opt_names[i], d); }
Restore the correct operation on interlaced mpegs.
Obviously a simple arg parsing problem... but I must say I have no clue why current rev it doesn't work as expected, more specifically under win32... I'll add some debug dump to see what happens, meanwhile if someone has an idea ;-)
I compiled SVN-11604 and more than Win32 the problem seems to be MinGW specific:
gcc 3.4.4 compiling to Cygwin honors interlacing & -top. gcc 3.4.4 crosscompiling to MinGW doesn't honor them.
Smells like broken isnan() in Windows. Hardly a surprise given their history of floating-point breakage. -- M?ns Rullg?rd mans at mansr.com
M?ns Rullg?rd wrote:
Smells like broken isnan() in Windows. Hardly a surprise given their
history of floating-point breakage.
on the other hand the code with double/isnan is working ok... It is the new one with strings that is borken... Chris.
christophelorenz <christophelorenz at gmail.com> writes:
M?ns Rullg?rd wrote:
Smells like broken isnan() in Windows. Hardly a surprise given their
history of floating-point breakage.
on the other hand the code with double/isnan is working ok... It is the new one with strings that is borken...
Right, I got the versions mixed up. Well, it still smells like windows is broken, as if that were news... -- M?ns Rullg?rd mans at mansr.com
On Sat, Jan 26, 2008 at 11:55:17PM +0000, M?ns Rullg?rd wrote:
christophelorenz <christophelorenz at gmail.com> writes:
M?ns Rullg?rd wrote:
Smells like broken isnan() in Windows. Hardly a surprise given their
history of floating-point breakage.
on the other hand the code with double/isnan is working ok... It is the new one with strings that is borken...
Right, I got the versions mixed up. Well, it still smells like windows is broken, as if that were news...
Using isnan is rather pointless; it's only use is to test nan without affecting floating point exception status. Just test if (d==d) instead.. Rich
Ok, I found the source of the problem... When parsing flags, the flags values are represented internally as a number, passed as in a string. The problem is that the flags are represented as hex values 0x20140000 while the other values are base 10. So when ff_eval2 wants to parse the flag number, it has to parse hex. Didn't go further into ff_eval2 but I can say that under linux it can parse hex but not under win32 : ff_eval2("0x20140000"....)=0 So the fix is either make ff_eval2 work with hex under win32, or return the flags as base10 numbers. The base10 fix consist simply in a one line change in opt.c I can't tell if it can have other implication in the code however. Index: /ffmpeg/libavcodec/opt.c =================================================================== --- /ffmpeg/libavcodec/opt.c (revision 11625) +++ /ffmpeg/libavcodec/opt.c (working copy) @@ -225,7 +225,7 @@ if(o_out) *o_out= o; switch(o->type){ - case FF_OPT_TYPE_FLAGS: snprintf(buf, buf_len, "0x%08X",*(int *)dst);break; + case FF_OPT_TYPE_FLAGS: snprintf(buf, buf_len, "%d",*(int *)dst);break; case FF_OPT_TYPE_INT: snprintf(buf, buf_len, "%d" , *(int *)dst);break; case FF_OPT_TYPE_INT64: snprintf(buf, buf_len, "%"PRId64, *(int64_t*)dst);break; case FF_OPT_TYPE_FLOAT: snprintf(buf, buf_len, "%f" , *(float *)dst);break; Chris.
On Sun, Jan 27, 2008 at 01:26:40AM +0100, christophelorenz wrote:
Ok, I found the source of the problem...
When parsing flags, the flags values are represented internally as a number, passed as in a string.
The problem is that the flags are represented as hex values 0x20140000 while the other values are base 10. So when ff_eval2 wants to parse the flag number, it has to parse hex. Didn't go further into ff_eval2 but I can say that under linux it can parse hex but not under win32 : ff_eval2("0x20140000"....)=0
So the fix is either make ff_eval2 work with hex under win32, or return the flags as base10 numbers.
The base10 fix consist simply in a one line change in opt.c I can't tell if it can have other implication in the code however.
flags should be printed in hex or as a series of named constants base10 is unreadable [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB No human being will ever know the Truth, for even if they happen to say it by chance, they would not even known they had done so. -- Xenophanes
Hello, On Sat, Jan 26, 2008 at 07:16:31PM -0500, Rich Felker wrote:
Using isnan is rather pointless; it's only use is to test nan without affecting floating point exception status. Just test if (d==d) instead..
Actually IIRC isnan was specifically used because (d==d) did not work sometimes (with -ffast-math or so?)
Hi! Sunday 27 January 2008 09:18-kor Reimar D?ffinger ezt ?rta:
Hello,
On Sat, Jan 26, 2008 at 07:16:31PM -0500, Rich Felker wrote:
Using isnan is rather pointless; it's only use is to test nan without affecting floating point exception status. Just test if (d==d) instead..
Actually IIRC isnan was specifically used because (d==d) did not work sometimes (with -ffast-math or so?)
Exactly, see the email on this list by Marc Hoffman, dated 2007. 09. 04. 23.25, subject "Re: [FFmpeg-devel] ffmpeg and argument parsing." bye Denes
On Sun, Jan 27, 2008 at 09:18:02AM +0100, Reimar D?ffinger wrote:
Hello, On Sat, Jan 26, 2008 at 07:16:31PM -0500, Rich Felker wrote:
Using isnan is rather pointless; it's only use is to test nan without affecting floating point exception status. Just test if (d==d) instead..
Actually IIRC isnan was specifically used because (d==d) did not work sometimes (with -ffast-math or so?)
isnan was added by the ISO C committee, who has no interest in brain-damaged gcc optimizations that violate the standard. The purpose of isnan is that evaluating d==d is allowed to affect the floating point machine status (irrelevant unless it's in use) but isnan is required to work without affecting the status. The gcc folks may be doing broken optimizations of d==d when -ffast-math is specified, but I would hope not. This is certainly wrong and positively useless as an optimization; no one would ever write d==d unless they mean to test for nan. Rich
On Sun, 2008-01-27 at 16:03 -0500, Rich Felker wrote:
The gcc folks may be doing broken optimizations of d==d when -ffast-math is specified, but I would hope not. This is certainly wrong and positively useless as an optimization; no one would ever write d==d unless they mean to test for nan.
-ffast-math is explicitly specified as an "unsafe" optimization which will not follow IEEE floating point rules. It implies -ffinite-math-only which makes optimizations assume no argument or result will be a NaN or Inf. It wouldn't make much sense to special-case an explicit test like "d==d" and separate it from cases where the compiler can otherwise deduce a value will be compared with itself. So based on the description of the option gcc is doing the correct thing when it always evaluates d==d to true.
On Sat, Jan 26, 2008 at 11:55:17PM +0000, M?ns Rullg?rd wrote:
christophelorenz <christophelorenz at gmail.com> writes:
M?ns Rullg?rd wrote:
Smells like broken isnan() in Windows. Hardly a surprise given their
history of floating-point breakage.
on the other hand the code with double/isnan is working ok... It is the new one with strings that is borken...
Right, I got the versions mixed up. Well, it still smells like windows is broken, as if that were news...
my guess is strtod("0x1234") doesnt work on windows [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you really think that XML is the answer, then you definitly missunderstood the question -- Attila Kinali
On Sun, 27 Jan 2008, Michael Niedermayer wrote:
Right, I got the versions mixed up. Well, it still smells like windows is broken, as if that were news...
my guess is strtod("0x1234") doesnt work on windows
Sounds like it is: http://cygwin.com/ml/cygwin/2006-06/msg00644.html Wouldn't strtol be more appropriate for flags?
On Sat, Jan 26, 2008 at 05:10:37PM -0800, Trent Piepho wrote:
On Sun, 27 Jan 2008, Michael Niedermayer wrote:
Right, I got the versions mixed up. Well, it still smells like windows is broken, as if that were news...
my guess is strtod("0x1234") doesnt work on windows
Sounds like it is: http://cygwin.com/ml/cygwin/2006-06/msg00644.html
Wouldn't strtol be more appropriate for flags?
try to RTFS and you will understand why its strtod and not strtol [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Thouse who are best at talking, realize last or never when they are wrong.
On Sun, Jan 27, 2008 at 04:44:33AM +0100, Michael Niedermayer wrote:
On Sat, Jan 26, 2008 at 05:10:37PM -0800, Trent Piepho wrote:
On Sun, 27 Jan 2008, Michael Niedermayer wrote:
Right, I got the versions mixed up. Well, it still smells like windows is broken, as if that were news...
my guess is strtod("0x1234") doesnt work on windows
Sounds like it is: http://cygwin.com/ml/cygwin/2006-06/msg00644.html
Wouldn't strtol be more appropriate for flags?
try to RTFS and you will understand why its strtod and not strtol
Apparently libbrokenos needs to replace strtod with a working version... Rich
Rich Felker wrote:
Apparently libbrokenos needs to replace strtod with a working
version...
Is there an alternative to libbrokenos ? (Yes, I know one, but I won't name it) Can we implement a new strtod in ff ? I want to point out that it does not only affects the interlace... but all flags. Using -flag in command line means all previous flags are flushed to zero, and only last one is set. Chris.
Hello, On Sun, Jan 27, 2008 at 09:27:58AM +0100, christophelorenz wrote:
Rich Felker wrote:
Apparently libbrokenos needs to replace strtod with a working
version...
Is there an alternative to libbrokenos ? (Yes, I know one, but I won't name it) Can we implement a new strtod in ff ?
We already have av_strtod, but it is not used consistently (actually it is only used in eval.c). Attached patch adds a workaround to it, but I have some doubts if it should be done (on the other hand libbrokenos is not yet ready it seems...). Greetings, Reimar D?ffinger
Hello, On Sun, Jan 27, 2008 at 09:59:08AM +0100, Reimar D?ffinger wrote:
On Sun, Jan 27, 2008 at 09:27:58AM +0100, christophelorenz wrote:
Rich Felker wrote:
Apparently libbrokenos needs to replace strtod with a working version...
Is there an alternative to libbrokenos ? (Yes, I know one, but I won't name it) Can we implement a new strtod in ff ?
We already have av_strtod, but it is not used consistently (actually it is only used in eval.c). Attached patch adds a workaround to it, but I have some doubts if it should be done (on the other hand libbrokenos is not yet ready it seems...).
Sorry, this is a patch that actually compiles. No idea if it works though, I am not running a broken os right now :-P
Reimar D?ffinger wrote:
Sorry, this is a patch that actually compiles. No idea if it works though, I am not running a broken os right now :-P
Yes ! compiled 11629 with patch and it works as expected ;-) I read that solaris also has problems with hex in strtod... so win32 is not the only faulty os ;-) (for a change) Chris.
On Sun, 27 Jan 2008, christophelorenz wrote:
Reimar D?ffinger wrote:
Sorry, this is a patch that actually compiles. No idea if it works though, I am not running a broken os right now :-P
Yes ! compiled 11629 with patch and it works as expected ;-)
I read that solaris also has problems with hex in strtod... so win32 is not the only faulty os ;-) (for a change)
It's no so much a broken or faulty OS in this case, but an older standard. C89 didn't have strtod() parsing hex. It was added in C99. Note that octal was something else that was added to strtod() in C99. strtod("011") should have the value 11.0 under C89, but be 9.0 under C99.
On Sun, Jan 27, 2008 at 10:02:54AM -0800, Trent Piepho wrote:
On Sun, 27 Jan 2008, christophelorenz wrote:
Reimar D?ffinger wrote:
Sorry, this is a patch that actually compiles. No idea if it works though, I am not running a broken os right now :-P
Yes ! compiled 11629 with patch and it works as expected ;-)
I read that solaris also has problems with hex in strtod... so win32 is not the only faulty os ;-) (for a change)
It's no so much a broken or faulty OS in this case, but an older standard. C89 didn't have strtod() parsing hex. It was added in C99. Note that octal was something else that was added to strtod() in C99. strtod("011") should have the value 11.0 under C89, but be 9.0 under C99.
There is nothing about octal in C99. Octal float constants are not part of the C language nor strtod. Rich
Reimar D?ffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de> writes:
Hello, On Sun, Jan 27, 2008 at 09:59:08AM +0100, Reimar D?ffinger wrote:
On Sun, Jan 27, 2008 at 09:27:58AM +0100, christophelorenz wrote:
Rich Felker wrote:
Apparently libbrokenos needs to replace strtod with a working version...
Is there an alternative to libbrokenos ? (Yes, I know one, but I won't name it) Can we implement a new strtod in ff ?
We already have av_strtod, but it is not used consistently (actually it is only used in eval.c). Attached patch adds a workaround to it, but I have some doubts if it should be done (on the other hand libbrokenos is not yet ready it seems...).
Sorry, this is a patch that actually compiles. No idea if it works though, I am not running a broken os right now :-P
Index: libavcodec/eval.c =================================================================== --- libavcodec/eval.c (revision 11627) +++ libavcodec/eval.c (working copy) @@ -91,6 +91,8 @@ double d; char *next; d = strtod(name, &next); + if (d == 0 && name[0] == '0' && name[1] == 'x') // HACK around broken strtod + d = strtol(name, &next, 0); /* if parsing succeeded, check for and interpret postfixes */ if (next!=name) {
This will break non-integer hex values. -- M?ns Rullg?rd mans at mansr.com
Hello, On Sun, Jan 27, 2008 at 01:18:54PM +0000, M?ns Rullg?rd wrote:
Reimar D?ffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de> writes:
Sorry, this is a patch that actually compiles. No idea if it works though, I am not running a broken os right now :-P
Index: libavcodec/eval.c =================================================================== --- libavcodec/eval.c (revision 11627) +++ libavcodec/eval.c (working copy) @@ -91,6 +91,8 @@ double d; char *next; d = strtod(name, &next); + if (d == 0 && name[0] == '0' && name[1] == 'x') // HACK around broken strtod + d = strtol(name, &next, 0); /* if parsing succeeded, check for and interpret postfixes */ if (next!=name) {
This will break non-integer hex values.
I think this should not break anything, since it should only do something in already broken cases. But it is true that it will not handle hex floating point values (including integer ones like 0x1p4), though to my knowledge these are not used internally at least. Either way it was only meant as a quick hack against the worst problems, I certainly would not endorse it as a permanent solution. Greetings, Reimar D?ffinger
On Sun, Jan 27, 2008 at 02:32:08PM +0100, Reimar D?ffinger wrote:
Hello, On Sun, Jan 27, 2008 at 01:18:54PM +0000, M?ns Rullg?rd wrote:
Reimar D?ffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de> writes:
Sorry, this is a patch that actually compiles. No idea if it works though, I am not running a broken os right now :-P
Index: libavcodec/eval.c =================================================================== --- libavcodec/eval.c (revision 11627) +++ libavcodec/eval.c (working copy) @@ -91,6 +91,8 @@ double d; char *next; d = strtod(name, &next); + if (d == 0 && name[0] == '0' && name[1] == 'x') // HACK around broken strtod + d = strtol(name, &next, 0); /* if parsing succeeded, check for and interpret postfixes */ if (next!=name) {
This will break non-integer hex values.
I think this should not break anything, since it should only do something in already broken cases.
No, it breaks things on CORRECT platforms for the sake of working around a bug on BROKEN platforms. This is unacceptable. Rich
On Sun, Jan 27, 2008 at 04:04:27PM -0500, Rich Felker wrote:
On Sun, Jan 27, 2008 at 02:32:08PM +0100, Reimar D?ffinger wrote:
Hello, On Sun, Jan 27, 2008 at 01:18:54PM +0000, M?ns Rullg?rd wrote:
Reimar D?ffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de> writes:
Sorry, this is a patch that actually compiles. No idea if it works though, I am not running a broken os right now :-P
Index: libavcodec/eval.c =================================================================== --- libavcodec/eval.c (revision 11627) +++ libavcodec/eval.c (working copy) @@ -91,6 +91,8 @@ double d; char *next; d = strtod(name, &next); + if (d == 0 && name[0] == '0' && name[1] == 'x') // HACK around broken strtod + d = strtol(name, &next, 0); /* if parsing succeeded, check for and interpret postfixes */ if (next!=name) {
This will break non-integer hex values.
I think this should not break anything, since it should only do something in already broken cases.
No, it breaks things on CORRECT platforms for the sake of working around a bug on BROKEN platforms. This is unacceptable.
Well, then maybe this one. But even if I didn't make any real error this is still a stupid way to solve this...
Rich Felker wrote:
No, it breaks things on CORRECT platforms for the sake of working
around a bug on BROKEN platforms. This is unacceptable.
If tomorrow someone writes a piece of code that follows C99 standard and works ok on xxx but fails under linux, what will happen ? After that will come C102, C150, C200 and all will be different again and broken again. We live in a world full of unacceptable things (more important than a computer standards), however if you want to move on, you have to make compromises. I can hardly believe it is the first time ff contains a workaround for some faulty implementation. Unless you're coding hello world, I can safely say that all libs on all platforms are broken somewhere. Just that some are less than others.... Chris.
On Mon, Jan 28, 2008 at 10:33:14AM +0100, christophelorenz wrote:
Rich Felker wrote:
No, it breaks things on CORRECT platforms for the sake of working
around a bug on BROKEN platforms. This is unacceptable.
If tomorrow someone writes a piece of code that follows C99 standard and works ok on xxx but fails under linux, what will happen ? After that will come C102, C150, C200 and all will be different again and broken again.
We live in a world full of unacceptable things (more important than a computer standards), however if you want to move on, you have to make compromises.
I can hardly believe it is the first time ff contains a workaround for some faulty implementation. Unless you're coding hello world, I can safely say that all libs on all platforms are broken somewhere. Just that some are less than others....
Your rant is misplaced. I never in this thread said you can't work around broken platforms, just that you cannot cause regressions on valid platforms in the process. The traditional development model of special-casing every known broken platform and failing to support a not-already-known but fully-standards-conformant platform at all needs to DIE. I still think this issue should be addressed with libbrokenos. But I won't object to any workarounds that do not bloat or break working systems. (Including our own implementation of strtod in ffmpeg would be bloat; using strtol whenever "0x" is seen would be breaking functionality, namely the ability to provide bit-exact floats.) Rich
Rich Felker wrote:
On Mon, Jan 28, 2008 at 10:33:14AM +0100, christophelorenz wrote:
Rich Felker wrote:
No, it breaks things on CORRECT platforms for the sake of working
around a bug on BROKEN platforms. This is unacceptable.
If tomorrow someone writes a piece of code that follows C99 standard and works ok on xxx but fails under linux, what will happen ? After that will come C102, C150, C200 and all will be different again and broken again.
We live in a world full of unacceptable things (more important than a computer standards), however if you want to move on, you have to make compromises.
I can hardly believe it is the first time ff contains a workaround for some faulty implementation. Unless you're coding hello world, I can safely say that all libs on all platforms are broken somewhere. Just that some are less than others....
Your rant is misplaced. I never in this thread said you can't work around broken platforms, just that you cannot cause regressions on valid platforms in the process. The traditional development model of special-casing every known broken platform and failing to support a not-already-known but fully-standards-conformant platform at all needs to DIE.
I still think this issue should be addressed with libbrokenos. But I won't object to any workarounds that do not bloat or break working systems. (Including our own implementation of strtod in ffmpeg would be bloat; using strtol whenever "0x" is seen would be breaking functionality, namely the ability to provide bit-exact floats.)
You're right. Sorry about this. And I will definitely report this problem to the mingw project. But the background problem stays... If we can't change the model because other than hex is unacceptable, if we can't re-implement strtod, workaround the 0x interger parsing etc... I now wonder how we can get around this. #ifdef __MINGW32__ ? Change solaris and win32 docs to says "-flags (broken on this os, use last year's version)" ? Appart from that, I think that relying on a new functionnality like hex floats parsed in a string->double function is like putting a banana under your shoe. But that's a personnal point of view and I understand some can't agree on that and want to use all new features. Chris.
On Mon, Jan 28, 2008 at 12:07:53PM +0100, christophelorenz wrote:
Rich Felker wrote:
On Mon, Jan 28, 2008 at 10:33:14AM +0100, christophelorenz wrote:
Rich Felker wrote:
No, it breaks things on CORRECT platforms for the sake of working
around a bug on BROKEN platforms. This is unacceptable.
If tomorrow someone writes a piece of code that follows C99 standard and works ok on xxx but fails under linux, what will happen ? After that will come C102, C150, C200 and all will be different again and broken again.
We live in a world full of unacceptable things (more important than a computer standards), however if you want to move on, you have to make compromises.
I can hardly believe it is the first time ff contains a workaround for some faulty implementation. Unless you're coding hello world, I can safely say that all libs on all platforms are broken somewhere. Just that some are less than others....
Your rant is misplaced. I never in this thread said you can't work around broken platforms, just that you cannot cause regressions on valid platforms in the process. The traditional development model of special-casing every known broken platform and failing to support a not-already-known but fully-standards-conformant platform at all needs to DIE.
I still think this issue should be addressed with libbrokenos. But I won't object to any workarounds that do not bloat or break working systems. (Including our own implementation of strtod in ffmpeg would be bloat; using strtol whenever "0x" is seen would be breaking functionality, namely the ability to provide bit-exact floats.)
You're right. Sorry about this. And I will definitely report this problem to the mingw project.
But the background problem stays... If we can't change the model because other than hex is unacceptable, if we can't re-implement strtod, workaround the 0x interger parsing etc... I now wonder how we can get around this.
you can get around this by having av_get_string() return a series of named flags like "trell+cbp+mv0", this also would be more readable to humans than 0x00040201 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If a bugfix only changes things apparently unrelated to the bug with no further explanation, that is a good sign that the bugfix is wrong.
Hi, Michael Niedermayer wrote:
On Mon, Jan 28, 2008 at 12:07:53PM +0100, christophelorenz wrote:
Rich Felker wrote:
On Mon, Jan 28, 2008 at 10:33:14AM +0100, christophelorenz wrote:
Rich Felker wrote:
No, it breaks things on CORRECT platforms for the sake of working
around a bug on BROKEN platforms. This is unacceptable.
If tomorrow someone writes a piece of code that follows C99 standard and works ok on xxx but fails under linux, what will happen ? After that will come C102, C150, C200 and all will be different again and broken again.
We live in a world full of unacceptable things (more important than a computer standards), however if you want to move on, you have to make compromises.
I can hardly believe it is the first time ff contains a workaround for some faulty implementation. Unless you're coding hello world, I can safely say that all libs on all platforms are broken somewhere. Just that some are less than others....
Your rant is misplaced. I never in this thread said you can't work around broken platforms, just that you cannot cause regressions on valid platforms in the process. The traditional development model of special-casing every known broken platform and failing to support a not-already-known but fully-standards-conformant platform at all needs to DIE.
I still think this issue should be addressed with libbrokenos. But I won't object to any workarounds that do not bloat or break working systems. (Including our own implementation of strtod in ffmpeg would be bloat; using strtol whenever "0x" is seen would be breaking functionality, namely the ability to provide bit-exact floats.)
You're right. Sorry about this. And I will definitely report this problem to the mingw project.
But the background problem stays... If we can't change the model because other than hex is unacceptable, if we can't re-implement strtod, workaround the 0x interger parsing etc... I now wonder how we can get around this.
you can get around this by having av_get_string() return a series of named flags like "trell+cbp+mv0", this also would be more readable to humans than 0x00040201
Any reason for printing flags values as hex instead of decimal ? Code is from r4581. Attached patch fixes the issue it seems. -- Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA Smartjog USA Inc. http://www.smartjog.com Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Baptiste Coudurier <baptiste.coudurier at smartjog.com> writes:
Hi,
Michael Niedermayer wrote:
On Mon, Jan 28, 2008 at 12:07:53PM +0100, christophelorenz wrote:
Rich Felker wrote:
On Mon, Jan 28, 2008 at 10:33:14AM +0100, christophelorenz wrote:
Rich Felker wrote:
No, it breaks things on CORRECT platforms for the sake of working
around a bug on BROKEN platforms. This is unacceptable.
If tomorrow someone writes a piece of code that follows C99 standard and works ok on xxx but fails under linux, what will happen ? After that will come C102, C150, C200 and all will be different again and broken again.
We live in a world full of unacceptable things (more important than a computer standards), however if you want to move on, you have to make compromises.
I can hardly believe it is the first time ff contains a workaround for some faulty implementation. Unless you're coding hello world, I can safely say that all libs on all platforms are broken somewhere. Just that some are less than others....
Your rant is misplaced. I never in this thread said you can't work around broken platforms, just that you cannot cause regressions on valid platforms in the process. The traditional development model of special-casing every known broken platform and failing to support a not-already-known but fully-standards-conformant platform at all needs to DIE.
I still think this issue should be addressed with libbrokenos. But I won't object to any workarounds that do not bloat or break working systems. (Including our own implementation of strtod in ffmpeg would be bloat; using strtol whenever "0x" is seen would be breaking functionality, namely the ability to provide bit-exact floats.)
You're right. Sorry about this. And I will definitely report this problem to the mingw project.
But the background problem stays... If we can't change the model because other than hex is unacceptable, if we can't re-implement strtod, workaround the 0x interger parsing etc... I now wonder how we can get around this. you can get around this by having av_get_string() return a series of named flags like "trell+cbp+mv0", this also would be more readable to humans than 0x00040201
Any reason for printing flags values as hex instead of decimal ? Code is from r4581. Attached patch fixes the issue it seems.
Index: libavcodec/opt.c =================================================================== --- libavcodec/opt.c (revision 15417) +++ libavcodec/opt.c (working copy) @@ -239,7 +239,7 @@ if(o_out) *o_out= o;
switch(o->type){ - case FF_OPT_TYPE_FLAGS: snprintf(buf, buf_len, "0x%08X",*(int *)dst);break; + case FF_OPT_TYPE_FLAGS: snprintf(buf, buf_len, "%d",*(int *)dst);break;
What? Hex is much easier to read than decimal. -- M?ns Rullg?rd mans at mansr.com
On 26 Sep 2008, at 00:35, M?ns Rullg?rd wrote:
Baptiste Coudurier <baptiste.coudurier at smartjog.com> writes:
Michael Niedermayer wrote:
On Mon, Jan 28, 2008 at 12:07:53PM +0100, christophelorenz wrote:
Rich Felker wrote:
On Mon, Jan 28, 2008 at 10:33:14AM +0100, christophelorenz wrote:
Rich Felker wrote: > No, it breaks things on CORRECT platforms for the sake of > working > > around a bug on BROKEN platforms. This is unacceptable.
If tomorrow someone writes a piece of code that follows C99 standard and works ok on xxx but fails under linux, what will happen ? After that will come C102, C150, C200 and all will be different again and broken again.
We live in a world full of unacceptable things (more important than a computer standards), however if you want to move on, you have to make compromises.
I can hardly believe it is the first time ff contains a workaround for some faulty implementation. Unless you're coding hello world, I can safely say that all libs on all platforms are broken somewhere. Just that some are less than others....
Your rant is misplaced. I never in this thread said you can't work around broken platforms, just that you cannot cause regressions on valid platforms in the process. The traditional development model of special-casing every known broken platform and failing to support a not-already-known but fully-standards-conformant platform at all needs to DIE.
I still think this issue should be addressed with libbrokenos. But I won't object to any workarounds that do not bloat or break working systems. (Including our own implementation of strtod in ffmpeg would be bloat; using strtol whenever "0x" is seen would be breaking functionality, namely the ability to provide bit-exact floats.)
You're right. Sorry about this. And I will definitely report this problem to the mingw project.
But the background problem stays... If we can't change the model because other than hex is unacceptable, if we can't re-implement strtod, workaround the 0x interger parsing etc... I now wonder how we can get around this.
you can get around this by having av_get_string() return a series of named flags like "trell+cbp+mv0", this also would be more readable to humans than 0x00040201
Any reason for printing flags values as hex instead of decimal ? Code is from r4581. Attached patch fixes the issue it seems.
Index: libavcodec/opt.c =================================================================== --- libavcodec/opt.c (revision 15417) +++ libavcodec/opt.c (working copy) @@ -239,7 +239,7 @@ if(o_out) *o_out= o;
switch(o->type){ - case FF_OPT_TYPE_FLAGS: snprintf(buf, buf_len, "0x %08X",*(int *)dst);break; + case FF_OPT_TYPE_FLAGS: snprintf(buf, buf_len, "%d",*(int *)dst);break;
What? Hex is much easier to read than decimal.
I agree, decimal isn't fun to read for flags, hex is much easier. Binary may be better still. :) Rob
Robert Swain wrote:
On 26 Sep 2008, at 00:35, M?ns Rullg?rd wrote:
Baptiste Coudurier <baptiste.coudurier at smartjog.com> writes:
Michael Niedermayer wrote:
On Mon, Jan 28, 2008 at 12:07:53PM +0100, christophelorenz wrote:
Rich Felker wrote:
On Mon, Jan 28, 2008 at 10:33:14AM +0100, christophelorenz wrote: > Rich Felker wrote: >> No, it breaks things on CORRECT platforms for the sake of >> working >> >> around a bug on BROKEN platforms. This is unacceptable.
> If tomorrow someone writes a piece of code that follows C99 > standard and works ok on xxx but fails under linux, what will > happen ? > After that will come C102, C150, C200 and all will be different > again and broken again. > > We live in a world full of unacceptable things (more important > than a computer standards), however if you want to move on, you > have to make compromises. > > I can hardly believe it is the first time ff contains a > workaround for some faulty implementation. > Unless you're coding hello world, I can safely say that all libs > on all platforms are broken somewhere. Just that some are less > than others....
Your rant is misplaced. I never in this thread said you can't work around broken platforms, just that you cannot cause regressions on valid platforms in the process. The traditional development model of special-casing every known broken platform and failing to support a not-already-known but fully-standards-conformant platform at all needs to DIE.
I still think this issue should be addressed with libbrokenos. But I won't object to any workarounds that do not bloat or break working systems. (Including our own implementation of strtod in ffmpeg would be bloat; using strtol whenever "0x" is seen would be breaking functionality, namely the ability to provide bit-exact floats.)
You're right. Sorry about this. And I will definitely report this problem to the mingw project.
But the background problem stays... If we can't change the model because other than hex is unacceptable, if we can't re-implement strtod, workaround the 0x interger parsing etc... I now wonder how we can get around this.
you can get around this by having av_get_string() return a series of named flags like "trell+cbp+mv0", this also would be more readable to humans than 0x00040201 Any reason for printing flags values as hex instead of decimal ? Code is from r4581. Attached patch fixes the issue it seems.
Index: libavcodec/opt.c =================================================================== --- libavcodec/opt.c (revision 15417) +++ libavcodec/opt.c (working copy) @@ -239,7 +239,7 @@ if(o_out) *o_out= o;
switch(o->type){ - case FF_OPT_TYPE_FLAGS: snprintf(buf, buf_len, "0x %08X",*(int *)dst);break; + case FF_OPT_TYPE_FLAGS: snprintf(buf, buf_len, "%d",*(int *)dst);break; What? Hex is much easier to read than decimal.
I agree, decimal isn't fun to read for flags, hex is much easier. Binary may be better still. :)
And like Michael said, strings are even easier ... Stop joking guys, we are talking about fixing issue here, please. -- Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA Smartjog USA Inc. http://www.smartjog.com Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
On Sun, Jan 27, 2008 at 09:27:58AM +0100, christophelorenz wrote:
Rich Felker wrote:
Apparently libbrokenos needs to replace strtod with a working version...
Is there an alternative to libbrokenos ?
Report a bug to MinGW. This is something you should do anyway. Diego
Diego Biurrun a ?crit :
On Sun, Jan 27, 2008 at 09:27:58AM +0100, christophelorenz wrote:
Rich Felker wrote:
Apparently libbrokenos needs to replace strtod with a working version...
Is there an alternative to libbrokenos ?
Report a bug to MinGW. This is something you should do anyway.
Are we 100% sure strtod *should* accept 0x1234? On linux debian etch the man page for strtod says this: "A hexadecimal number consists of a ``0x'' or ``0X'' followed by a nonempty sequence of hexadecimal digits possibly con- taining a radix character, optionally followed by a binary exponent. A binary exponent consists of a ``P'' or ``p'', fol- lowed by an optional plus or minus sign, followed by a non-empty sequence of decimal digits, and indicates multiplication by a power of 2. At least one of radix character and binary exponent must be present." Seems to me 0x1234 is *not* legal since it contains neither radix nor binary exponent... Of course, man pages are not always the best source for standards! Note that the official MS (on-web0 doc states: "strtod expects nptr to point to a string of the following form: [whitespace] [sign] [digits] [.digits] [ {d | D | e | E}[sign]digits] A whitespace may consist of space and tab characters, which are ignored; sign is either plus (+) or minus (?); and digits are one or more decimal digits. If no digits appear before the radix character, at least one must appear after the radix character. The decimal digits can be followed by an exponent, which consists of an introductory letter (d, D, e, or E) and an optionally signed integer. If neither an exponent part nor a radix character appears, a radix character is assumed to follow the last digit in the string. The first character that does not fit this form stops the scan." So it may be a bit too strong to say its broken, its just C89-compliant and not C9x, something MS made no mystery about. -- Michel Bardiaux R&D Director T +32 [0] 2 790 29 41 F +32 [0] 2 790 29 02 E mailto:mbardiaux at mediaxim.be Mediaxim NV/SA Vorstlaan 191 Boulevard du Souverain Brussel 1160 Bruxelles http://www.mediaxim.com/
Michel Bardiaux wrote:
Diego Biurrun a ?crit :
On Sun, Jan 27, 2008 at 09:27:58AM +0100, christophelorenz wrote:
Rich Felker wrote:
Apparently libbrokenos needs to replace strtod with a working version...
Is there an alternative to libbrokenos ?
Report a bug to MinGW. This is something you should do anyway.
Are we 100% sure strtod *should* accept 0x1234? On linux debian etch the man page for strtod says this:
"A hexadecimal number consists of a ``0x'' or ``0X'' followed by a nonempty sequence of hexadecimal digits possibly con- taining a radix character, optionally followed by a binary exponent. A binary exponent consists of a ``P'' or ``p'', fol- lowed by an optional plus or minus sign, followed by a non-empty sequence of decimal digits, and indicates multiplication by a power of 2. At least one of radix character and binary exponent must be present."
Seems to me 0x1234 is *not* legal since it contains neither radix nor binary exponent...
Of course, man pages are not always the best source for standards!
The spec says this: The expected form of the subject sequence is an optional plus or minus sign, then one of the following: [...] - A 0x or 0X, then a non-empty sequence of hexadecimal digits optionally containing a radix character, then an optional binary exponent part Clearly, they are both optional. See also http://www.opengroup.org/onlinepubs/009695399/functions/strtod.html, in particular the example at the end of the page. -- M?ns Rullg?rd mans at mansr.com
M?ns Rullg?rd wrote:
Michel Bardiaux wrote: [snip]
Are we 100% sure strtod *should* accept 0x1234? On linux debian etch the man page for strtod says this:
"A hexadecimal number consists of a ``0x'' or ``0X'' followed by a nonempty sequence of hexadecimal digits possibly con- taining a radix character, optionally followed by a binary exponent. A binary exponent consists of a ``P'' or ``p'', fol- lowed by an optional plus or minus sign, followed by a non-empty sequence of decimal digits, and indicates multiplication by a power of 2. At least one of radix character and binary exponent must be present."
Seems to me 0x1234 is *not* legal since it contains neither radix nor binary exponent...
Of course, man pages are not always the best source for standards!
The spec says this:
The expected form of the subject sequence is an optional plus or minus sign, then one of the following: [...] - A 0x or 0X, then a non-empty sequence of hexadecimal digits optionally containing a radix character, then an optional binary exponent part
Clearly, they are both optional.
See also http://www.opengroup.org/onlinepubs/009695399/functions/strtod.html, in particular the example at the end of the page.
Meaning the man page is again wrong (or at the very least, very badly written). Annoying but hardly surprising.
Hello, On Mon, Jan 28, 2008 at 02:25:50PM +0100, Michel Bardiaux wrote:
M?ns Rullg?rd wrote:
Michel Bardiaux wrote: [snip]
Are we 100% sure strtod *should* accept 0x1234? On linux debian etch the man page for strtod says this:
"A hexadecimal number consists of a ``0x'' or ``0X'' followed by a nonempty sequence of hexadecimal digits possibly con- taining a radix character, optionally followed by a binary exponent. A binary exponent consists of a ``P'' or ``p'', fol- lowed by an optional plus or minus sign, followed by a non-empty sequence of decimal digits, and indicates multiplication by a power of 2. At least one of radix character and binary exponent must be present."
Seems to me 0x1234 is *not* legal since it contains neither radix nor binary exponent...
Of course, man pages are not always the best source for standards!
The spec says this:
The expected form of the subject sequence is an optional plus or minus sign, then one of the following: [...] - A 0x or 0X, then a non-empty sequence of hexadecimal digits optionally containing a radix character, then an optional binary exponent part
Clearly, they are both optional.
See also http://www.opengroup.org/onlinepubs/009695399/functions/strtod.html, in particular the example at the end of the page.
Meaning the man page is again wrong (or at the very least, very badly written). Annoying but hardly surprising.
That is exaggerating things, it is a bit confusing though. The thing to realize is that the last two sentences belong together and describe how an exponent must look like - and do not change that the exponent itself is optional. But I'm sure they will not mind a patch improving it ;-)
On Mon, Jan 28, 2008 at 11:06:51AM +0100, Michel Bardiaux wrote:
Are we 100% sure strtod *should* accept 0x1234? On linux debian etch the man page for strtod says this:
"A hexadecimal number consists of a ``0x'' or ``0X'' followed by a nonempty sequence of hexadecimal digits possibly con- taining a radix character, optionally followed by a binary exponent. A binary exponent consists of a ``P'' or ``p'', fol- lowed by an optional plus or minus sign, followed by a non-empty sequence of decimal digits, and indicates multiplication by a power of 2. At least one of radix character and binary exponent must be present."
Seems to me 0x1234 is *not* legal since it contains neither radix nor binary exponent...
You missed the word "optional".. :)
Of course, man pages are not always the best source for standards!
Note that the official MS (on-web0 doc states:
"strtod expects nptr to point to a string of the following form:
[whitespace] [sign] [digits] [.digits] [ {d | D | e | E}[sign]digits]
A whitespace may consist of space and tab characters, which are ignored; sign is either plus (+) or minus (?); and digits are one or more decimal digits. If no digits appear before the radix character, at least one must appear after the radix character. The decimal digits can be followed by an exponent, which consists of an introductory letter (d, D, e, or E) and an optionally signed integer. If neither an exponent part nor a radix character appears, a radix character is assumed to follow the last digit in the string. The first character that does not fit this form stops the scan."
So it may be a bit too strong to say its broken, its just C89-compliant and not C9x, something MS made no mystery about.
I wouldn't be so quick to assume it even conforms to C89. The MS text there is very poorly written; for example, what is "the first character that does not fit this form" in the string "1.0e+"? The correct way to specify and document behavior is with phrases like "the largest initial substring that is of the form ...." or "the largest initial substring that is also an initial substring of a string of the form ..." etc. Rich
participants (13)
-
baptiste.coudurier@smartjog.com -
christophelorenz@gmail.com -
dalias@aerifal.cx -
dbalatoni@interware.hu -
diego@biurrun.de -
mans@mansr.com -
mbardiaux@mediaxim.be -
michaelni@gmx.at -
Reimar.Doeffinger@stud.uni-karlsruhe.de -
robert.swain@gmail.com -
uoti.urpala@pp1.inet.fi -
wzrlpy@arsystel.com -
xyzzy@speakeasy.org