-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[root6] Fix call to memset in TpcAvgCurrent.C #487
Conversation
plexoos
commented
Jan 30, 2023
``` StWarning: StDbSql::QueryDb(table,time) line=439 TpcAvgCurrent has No data for query LoadTable: .L /star-sw/StarDb/Calibrations/tpc/TpcAvgCurrent.C In file included from input_line_983:1: /star-sw/StarDb/Calibrations/tpc/TpcAvgCurrent.C:6:3: error: no matching function for call to 'memset' memset(row, 0, sizeof(TpcAvgCurrent_st)); ^~~~~~ /usr/include/string.h:62:14: note: candidate function not viable: no known conversion from 'TpcAvgCurrent_st' to 'void *' for 1st argument; take the address of the argument with & extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1)); ^ root4star: .sl79_gcc485/OBJ/StRoot/St_db_Maker/St_db_Maker.cxx:932: virtual TDataSet* St_db_Maker::LoadTable(TDataSet*): Assertion `!ee' failed. Aborted ```
I can't even view this directory on github because of all the old files that came and went: |
I think github must be having a problem at the moment. I was able to
review this earlier... but now I see the unfriendly unicorn.
…On 2023-01-30 11:42, Gene Van Buren wrote:
I can't even view this directory on github because of all the old
files that came and went:
https://github.com/star-bnl/star-sw/tree/main/StarDb/Calibrations/tpc
message from github (not my browser): "This page is taking too long to
load."
:-(
--
Reply to this email directly, view it on GitHub [1], or unsubscribe
[2].
You are receiving this because you commented.Message ID:
***@***.***>
Links:
------
[1]
#487 (comment)
[2]
https://github.com/notifications/unsubscribe-auth/ANL4LVA2OOC3TWZXKGQRIWDWU7VPVANCNFSM6AAAAAAUKR2FKI
|
I have a question about this, how did it ever work if it needed |
On Jan 30, 2023, at 11:54 AM, Irakli Chakaberia ***@***.***> wrote:
I have a question about this, how did it ever work if it needed &raw and had raw for many years till now?
Yeah, I was wondering the same, which is why I was trying to look at the history. Indeed, it's been wrong since the initial version:
https://www.star.bnl.gov/cgi-bin/protected/viewvc.cgi/cvsroot/StarDb/Calibrations/tpc/TpcAvgCurrent.C?revision=1.1&view=markup
Hm.
BTW, the old CVS browser also takes a little while to view that directory too, but eventually comes through.
https://www.star.bnl.gov/cgi-bin/protected/viewvc.cgi/cvsroot/StarDb/Calibrations/tpc/
…-Gene
|
ROOT/CINT is not a C++ compiler. It is a C++ flavored interpreter,
laced with several usability hacks... one of which blurs the distinction
between objects and pointers.
This code runs happily under ROOT5/CINT...
struct A_t { int a; int b; int c; };
void testdum() {
a.a = 1; a.b = 2; a.c = 3;
std::cout << "before questionable memset ... " << std::endl << a.a <<
" " << a.b << " " << a.c << std::endl;
memset( a, 0, sizeof(A_t) );
std::cout << " after questionable memset ... " << std::endl << a.a <<
" " << a.b << " " << a.c << std::endl;
};
And produces the output
before questionable memset ...
1 2 3
after questionable memset ...
0 0 0
So... the original code is not correct C++. But under CINT it should
work as the author intended.
Jason
…On 2023-01-30 12:31, Gene Van Buren wrote:
> On Jan 30, 2023, at 11:54 AM, Irakli Chakaberia ***@***.***> wrote:
> I have a question about this, how did it ever work if it needed &raw
and had raw for many years till now?
Yeah, I was wondering the same, which is why I was trying to look at
the history. Indeed, it's been wrong since the initial version:
https://www.star.bnl.gov/cgi-bin/protected/viewvc.cgi/cvsroot/StarDb/Calibrations/tpc/TpcAvgCurrent.C?revision=1.1&view=markup
Hm.
BTW, the old CVS browser also takes a little while to view that
directory too, but eventually comes through.
https://www.star.bnl.gov/cgi-bin/protected/viewvc.cgi/cvsroot/StarDb/Calibrations/tpc/
-Gene
--
Reply to this email directly, view it on GitHub [1], or unsubscribe
[2].
You are receiving this because you commented.Message ID:
***@***.***>
Links:
------
[1]
#487 (comment)
[2]
https://github.com/notifications/unsubscribe-auth/ANL4LVFYHF5M7URDRCCGL4TWU73HPANCNFSM6AAAAAAUKR2FKI
|
The old code worked because in reality a pointer was passed to memset regardless of what the source code said. This is the result of CINT not following the C++ standard but with ROOT6 cling we can detect such leeways and fix them. @iraklic you can still approve this PR if you feel like it. I was not sure it was worth waiting |
Thank you. That is kind of what I suspected, but I was thinking since we are compiling the code it would pass through the compilator C++ rules and not CINT, but I guess there are details that are not as clear to me in this regard. |
This particular file (actually all .C files in StarDB/Calibrations/) is "interpreted" by CINT/Cling |
Oh, right, that is the answer that puts things in place. Yes I forgot for a moment about our way with some cint files. Thanks. |