Re: 3 compilation warnings in trunk with conversion of double to int
On Mon, Oct 27, 2014 at 11:07 AM, Jean-Marc Lasgouttes wrote: > Le 27/10/2014 15:57, Scott Kostyshak a écrit : >>> >>> I did it. Just wanted to check first. >> >> >> Why is x a double? > > > There are doubles because spaces can have on integer width in justified text > (extra space has to be shared). When the text is rtl, the left margin can > have strange values. > > I agree though that it could be an int. Thanks, Scott
Re: 3 compilation warnings in trunk with conversion of double to int
Le 27/10/2014 15:57, Scott Kostyshak a écrit : I did it. Just wanted to check first. Why is x a double? There are doubles because spaces can have on integer width in justified text (extra space has to be shared). When the text is rtl, the left margin can have strange values. I agree though that it could be an int. JMarc
Re: 3 compilation warnings in trunk with conversion of double to int
On Mon, Oct 27, 2014 at 10:49 AM, Richard Heck wrote: > On 10/27/2014 08:15 AM, Jean-Marc Lasgouttes wrote: >> >> Le 27/10/2014 00:40, Richard Heck a écrit : >>> >>> This is from JMarc's recent changes. It's probably harmless. JMarc? >> >> >> Yes, these are harmless. I will fix them when I get some time. > > > I did it. Just wanted to check first. Why is x a double? Looking at /// the x position of the row (left margin) double x; /// the right margin of the row int right_margin; it's not clear why one should be a double and the other an int. They seem symmetric to me. Scott
Re: 3 compilation warnings in trunk with conversion of double to int
On 10/27/2014 08:15 AM, Jean-Marc Lasgouttes wrote: Le 27/10/2014 00:40, Richard Heck a écrit : This is from JMarc's recent changes. It's probably harmless. JMarc? Yes, these are harmless. I will fix them when I get some time. I did it. Just wanted to check first. Richard
Re: 3 compilation warnings in trunk with conversion of double to int
Le 27/10/2014 00:40, Richard Heck a écrit : This is from JMarc's recent changes. It's probably harmless. JMarc? Yes, these are harmless. I will fix them when I get some time. JMarc
Re: 3 compilation warnings in trunk with conversion of double to int
On 10/26/2014 08:37 AM, Uwe Stöhr wrote: After a long time I found time to take care of LyX. At first I compiles master and got 3 compilation warnings: * ..\..\src\Row.cpp(386): warning C4244: '=': conversion from 'double' to 'int', possible dataloss [D:\LyXGit\Master\compile-result\src\LyX.vcxproj] * ..\..\src\Row.cpp(408): warning C4244: '=': conversion from 'double' to 'int', possible dataloss [D:\LyXGit\Master\compile-result\src\LyX.vcxproj] * ..\..\src\TextMetrics.cpp(807): warning C4244: '=': conversion from 'double' to 'int', possible dataloss [D:\LyXGit\Master\compile-result\src\LyX.vcxproj] Can anybody plase have a look? This is from JMarc's recent changes. It's probably harmless. JMarc? Richard
3 compilation warnings in trunk with conversion of double to int
After a long time I found time to take care of LyX. At first I compiles master and got 3 compilation warnings: * ..\..\src\Row.cpp(386): warning C4244: '=': conversion from 'double' to 'int', possible dataloss [D:\LyXGit\Master\compile-result\src\LyX.vcxproj] * ..\..\src\Row.cpp(408): warning C4244: '=': conversion from 'double' to 'int', possible dataloss [D:\LyXGit\Master\compile-result\src\LyX.vcxproj] * ..\..\src\TextMetrics.cpp(807): warning C4244: '=': conversion from 'double' to 'int', possible dataloss [D:\LyXGit\Master\compile-result\src\LyX.vcxproj] Can anybody plase have a look? thanks and regards Uwe p.s. the 2.1.x branch compiles without warnings
Re: compiler warnings in trunk
On 10/04/2011 11:12 AM, Andre Poenitz wrote: On Sun, Apr 10, 2011 at 10:31:47AM -0400, Richard Heck wrote: On 04/09/2011 06:46 PM, Julien Rioux wrote: I always saw those two warnings (paraphrased): Lexer.cpp:197 may be used uninitialized void Lexer::Pimpl::verifyTable() { // [...] if (table<- this line? Doesn't look like this can ever be uninitialized. But if so, valgrind should be able to come up with more details. if (table && !lyx::sorted(table, table + no_items, CompareTags())) { It seems to complain about CompareTags(). Perhaps it's just the compiler's mistake. Running gcc 4.4.5 here. Server.cpp:1018 ignoring return value of write(...) This maybe the result of someone turning on -Wunused-result or someone adding __attribute__ ((warn_unused_result)) to the write() declaration. Checking the return value might actually be a good idea to make sure all the data was actually written. Andre' It's interesting that you can require the compiler to check for things like this. Sounds like a good idea for critical code. -- Julien
Re: compiler warnings in trunk
On Sun, Apr 10, 2011 at 10:31:47AM -0400, Richard Heck wrote: > On 04/09/2011 06:46 PM, Julien Rioux wrote: > >I always saw those two warnings (paraphrased): > >Lexer.cpp:197 may be used uninitialized void Lexer::Pimpl::verifyTable() { // [...] if (table <- this line? Doesn't look like this can ever be uninitialized. But if so, valgrind should be able to come up with more details. > >Server.cpp:1018 ignoring return value of write(...) This maybe the result of someone turning on -Wunused-result or someone adding __attribute__ ((warn_unused_result)) to the write() declaration. Checking the return value might actually be a good idea to make sure all the data was actually written. Andre'
Re: compiler warnings in trunk
On 04/09/2011 06:46 PM, Julien Rioux wrote: I always saw those two warnings (paraphrased): Lexer.cpp:197 may be used uninitialized Server.cpp:1018 ignoring return value of write(...) The Lexer one has been there forever. I'm not sure why we get it, and I'm certainly not sure why removing the anonymous namespace would suppress it. Maybe Andre could enlighten us. On the second one, it looks as it it probably is worth checking the return value and writing the error message if it's bad. There are other ways to deal with such warnings, if you don't really care about the return value, but I'm not remembering what they are. Richard
compiler warnings in trunk
I always saw those two warnings (paraphrased): Lexer.cpp:197 may be used uninitialized Server.cpp:1018 ignoring return value of write(...) I have looked into these two warnings to learn a bit more on cpp. For the first one, I could remove the warning by removing the anonymous namespace, but I have no idea of the implications of doing this. I'd like to hear comments why this warning is thrown. For the second, I think it's a matter of handling any error code returned by write. Something like the attached? -- Julien Index: src/Lexer.cpp === --- src/Lexer.cpp (revision 38319) +++ src/Lexer.cpp (working copy) @@ -132,8 +132,6 @@ -namespace { - class CompareTags : public binary_function { public: @@ -147,9 +145,7 @@ } }; -} // end of anon namespace - Lexer::Pimpl::Pimpl(LexerKeyword * tab, int num) : is(&fb_), table(tab), no_items(num), status(0), lineno(0), commentChar('#') Index: src/Server.cpp === --- src/Server.cpp (revision 38319) +++ src/Server.cpp (working copy) @@ -1015,7 +1015,11 @@ break; string const cmd = "LYXCMD:pipe:file-open:" + fname.absFileName() + '\n'; - ::write(pipefd, cmd.c_str(), cmd.length()); + if (::write(pipefd, cmd.c_str(), cmd.length()) < 0) { + lyxerr << "LyXComm: Problem while loading in single-instance mode." + << "\nLyXComm: Error sending message : " << cmd + << "\nLyXComm: " << strerror(errno) << endl; + } ::close(pipefd); ++loaded_files; it = theFilesToLoad().erase(it);
Re: Warnings in trunk
On 10/12/2010 08:15 PM, Pavel Sanda wrote: Pavel Sanda wrote: when opening or creating new files in trunk is see on the console messages like: Warning: 83 Warning: 34 i guess this has something to do with last changes in lyx2lyx. try to open eg additional manual. newly saved files do not have it. Looks like someone forgot to take out a bit of debugging code. I'll fix it later. Richard
Re: Warnings in trunk
> i guess this has something to do with last changes in lyx2lyx. Yes, it was a debug warning I forgot to delete before committing. I removed it now. regards Uwe
Re: Warnings in trunk
Pavel Sanda wrote: > when opening or creating new files in trunk is see on the console messages > like: > > Warning: 83 > Warning: 34 i guess this has something to do with last changes in lyx2lyx. try to open eg additional manual. newly saved files do not have it. > > pavel
Warnings in trunk
when opening or creating new files in trunk is see on the console messages like: Warning: 83 Warning: 34 pavel