[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] mcenum_emission: bit mask or not?

From: Greg Chicares
Subject: Re: [lmi] mcenum_emission: bit mask or not?
Date: Fri, 31 Jul 2015 00:14:24 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.3.0

On 2015-07-30 01:09, Greg Chicares wrote:
>   /lmi/src/lmi[0]$grep '&& *emission' *.?pp
>   gpt_server.cpp:    if(mce_emit_test_data && emission_)
>   mec_server.cpp:    if(mce_emit_test_data && emission_)
> I'll have to fix that.

Before correction:

/opt/lmi/bin[0]$./lmi_cli_shared.exe --accept --data_path=/opt/lmi/data 
--file=/opt/lmi/test/cvat000.mec --emit=emit_test_data
okay: should write /opt/lmi/test/cvat000.mec.xml, and does

/opt/lmi/bin[0]$./lmi_cli_shared.exe --accept --data_path=/opt/lmi/data 
--file=/opt/lmi/test/cvat000.mec --emit=emit_nothing
okay: should not write /opt/lmi/test/cvat000.mec.xml, and does not

/opt/lmi/bin[0]$./lmi_cli_shared.exe --accept --data_path=/opt/lmi/data 
--file=/opt/lmi/test/cvat000.mec --emit=emit_text_stream
ERROR: should not write /opt/lmi/test/cvat000.mec.xml, but does

Similar results are observed for '--file=/opt/lmi/test/a001.gpt.xml'.

The condition as originally written:
  if(mce_emit_test_data && emission_)
is true if both variables are nonzero. But mce_emit_test_data is a
constant with value 64, so it's always nonzero. Therefore, the
condition really was equivalent to
  if(0 != emission_)
Now, the only mce_emit* enumerator that equals zero, by deliberate
design, is mce_emit_nothing, so the condition really meant
  if(mce_emit_nothing != emission_)
which explains the observations above.

Fixed 20150731T0013Z, revision 6225.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]