So far I just see analysis tools fail for the same sorts of valid code...
this is a bit of C# but the same idea causes the same warnings and
there's nothign tecniclally wrong with this.
class test
{
struct large_struct { public int x; }
bool arbitrary_true_false = true;
void method()
{
bool initialized = false;
large_struct s;
if( arbitrary_true_false )
{
initialized = true;
s.x = 1;
}
if( initialized )
{
Console.WriteLine( "this fails(during compile) as
uninitialized: {0}", s.x );
}
}
}
On Mon, Mar 21, 2016 at 4:35 PM, James K. Lowden
<jklowden at schemamania.org> wrote:
> On Mon, 21 Mar 2016 13:48:06 -0700
> Scott Perry <numist at apple.com> wrote:
>
>> Compilers allow you to choose your standard; --std=c11 means
>> something very specific (and unchanging)
>
> They do. And that covers what the standard covers. The standard also
> has limits. It includes constructs that are syntactically permitted
> but whose behavior is left undefined, known by the scarred as "UB" for
> "undefined behavior". An example from Clang's discussion is
>
> int i = 10 << 31;
>
> The standard says << is a shift operator. It places no limit on the
> number of bits to be shifted. If that number is so large that the
> product cannot be represented by the assigned variable, that is *not*
> an error. The standard allows the compiler to do anything or nothing
> with it. As you may imagine, the varieties of anything and nothing are
> many.
>
> Compiler writers are well aware that "nothing" is faster done than
> "something". Over time, they have gotten more aggressive in simply
> deleting UB code. As a consequence, programmers who thought they wrote
> standards-conforming code get burned when they upgrade/change
> compilers. Mysterious and sometimes subtle errors are introduced by
> the compiler for the user's benefit.
>
> Your googlefu will turn up lots of discussion. One I liked that wasn't
> on Page 1:
>
>
> http://blog.frama-c.com/index.php?post/2013/10/09/Overflow-float-integer
>
> --jkl
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users