warnings

How to store 64 digits integer in C?

一曲冷凌霜 提交于 2020-05-23 07:23:33
问题 I am dealing with 2 64 digits integers and need to multiple these two numbers. When I tried to store it into a long long int variable, I got the following compiling error: 1.c: In function ‘main’: 1.c:5:6: warning: integer constant is too large for its type. a = 1234567890123456789012345678901234567890123456789012345678901234; Can someone tell me how to store the integer in C? [edit] OP later implies a 64 decimal digit number. 回答1:

PyCharm Says readline Import Not Being Used

我与影子孤独终老i 提交于 2020-05-15 08:12:15
问题 I had this code: while True: cmd = input('> ') if cmd == 'exit': break But I wanted to implement advanced text input features like command history so I imported the readline module. Importing the readline module (and not even using it) will unlock these features. This code works perfectly: import readline while True: cmd = input('> ') if cmd == 'exit': break My problem (or maybe just annoyance) is that PyCharm gives me a non-fatal warning that I have an unused import statement. I assume this

Is -Wreturn-std-move clang warning correct in case of objects in the same hierarchy?

穿精又带淫゛_ 提交于 2020-05-15 04:20:52
问题 Consider the following simple code: struct Base { Base() = default; Base(const Base&); Base(Base&&); }; struct Derived : Base { }; Base foo() { Derived derived; return derived; } clang 8.0.0 gives a warning -Wreturn-std-move on it: prog.cc:21:10: warning: local variable 'derived' will be copied despite being returned by name [-Wreturn-std-move] return derived; ^~~~~~~ prog.cc:21:10: note: call 'std::move' explicitly to avoid copying return derived; ^~~~~~~ std::move(derived) But if one called

return reference to temporary when dereferencing map iterator

谁都会走 提交于 2020-05-14 19:27:27
问题 Consider this code #include <iterator> #include <vector> const int& foo(const std::vector<int>& x,unsigned i) { auto it = x.begin(); std::advance(it,i); return *it; } Both clang and gcc emit no errors/warnings, but this: #include <iterator> #include <map> const std::pair<int,int>& bar(const std::map<int,int>& x,unsigned i){ auto it = x.begin(); std::advance(it,i); return *it; } compiled with clang and using -Werror results in : <source>:14:12: error: returning reference to local temporary

Is this an incorrect warning?

喜欢而已 提交于 2020-05-12 02:29:30
问题 Let's see this code pattern I'm seeing often: struct Foo { template <typename T> T* as1() { /* ... */ } template <typename T> T* as2(T*) { /* ... */ } }; The former method is to be used like this: SomeComplexTypeAndNotAuto * a = foo.as1<SomeComplexTypeAndNotAuto>(); While the latter is more convenient to use since you don't need to repeat the complex type: SomeComplexTypeAndNotAuto * a = foo.as2(a); However, most compiler rejects the 2nd case with a Wuninitialized warning: warning: variable

Is this an incorrect warning?

别来无恙 提交于 2020-05-12 02:26:22
问题 Let's see this code pattern I'm seeing often: struct Foo { template <typename T> T* as1() { /* ... */ } template <typename T> T* as2(T*) { /* ... */ } }; The former method is to be used like this: SomeComplexTypeAndNotAuto * a = foo.as1<SomeComplexTypeAndNotAuto>(); While the latter is more convenient to use since you don't need to repeat the complex type: SomeComplexTypeAndNotAuto * a = foo.as2(a); However, most compiler rejects the 2nd case with a Wuninitialized warning: warning: variable

Is it possible to use an old version of 'stats' package in R?

烈酒焚心 提交于 2020-04-30 10:47:15
问题 Is it possible to use an old version of the stats package in R? The function stats:::regularize.values causes me warnings and errors in the last R version (any version >3.5). I have no possibility to get back to an old R version. I have no clue where the regularize.values function is called in my code since I use several functions, some of them from different R packages. I've tried to change the call to regularize.values in my code by doing assignInNamespace("regularize.values", regularize

Why am I getting a warning for this range-based for loop in C++?

一曲冷凌霜 提交于 2020-04-10 12:51:29
问题 I am currently self-teaching myself C++ using Bjarne Stroustrup's book (2nd ed). In one of the examples, he uses a range-for-loop to read the elements in a vector. When I wrote and compiled the code for myself I get this warning. When I run the code, it seems to be working and calculates the mean. Why am I receiving this warning and should I ignore it? Also, why is the range-for using int instead of double in the example, but still returns a double? temp_vector.cpp:17:13: warning: range-based

Why am I getting a warning for this range-based for loop in C++?

允我心安 提交于 2020-04-10 12:49:37
问题 I am currently self-teaching myself C++ using Bjarne Stroustrup's book (2nd ed). In one of the examples, he uses a range-for-loop to read the elements in a vector. When I wrote and compiled the code for myself I get this warning. When I run the code, it seems to be working and calculates the mean. Why am I receiving this warning and should I ignore it? Also, why is the range-for using int instead of double in the example, but still returns a double? temp_vector.cpp:17:13: warning: range-based

Why am I getting a warning for this range-based for loop in C++?

孤街浪徒 提交于 2020-04-10 12:48:03
问题 I am currently self-teaching myself C++ using Bjarne Stroustrup's book (2nd ed). In one of the examples, he uses a range-for-loop to read the elements in a vector. When I wrote and compiled the code for myself I get this warning. When I run the code, it seems to be working and calculates the mean. Why am I receiving this warning and should I ignore it? Also, why is the range-for using int instead of double in the example, but still returns a double? temp_vector.cpp:17:13: warning: range-based