Here is a workaround:
def rename_file(old, new):
if sys.platform != 'win32':
os.rename(new, old)
else:
os.remove(old)
os.rename(new, old)
def rename_file(old, new):
if sys.platform != 'win32':
os.rename(new, old)
else:
os.remove(old)
os.rename(new, old)
// set_test.cpp
#include <stdint.h>
#include <bitset>
const int size = 128;
typedef uint8_t byte_set[size];
bool any_in_byteset(uint8_t* data, size_t size, byte_set set) {
for (auto i=0u; i < size; i++)
if (set[data[i]])
return true;
return false;
}
typedef std::bitset<size> bit_set;
bool any_in_bitset(uint8_t* data, size_t size, bit_set set) {
for (auto i=0u; i < size; i++)
if (set[data[i]])
return true;
return false;
}
28: 0f b6 10 movzbl (%eax),%edx 2b: 83 c0 01 add $0x1,%eax 2e: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 32: 75 0c jne 40 34: 39 d8 cmp %ebx,%eax 36: 75 f0 jne 28Statement if (set[data[i]]) return true are lines 28, 2e and 32, i.e.: load from memory, compare and jump. Instructions 2b, 34 and 36 handles the for loop.
5f: 0f b6 13 movzbl (%ebx),%edx 62: b8 01 00 00 00 mov $0x1,%eax 67: 89 d1 mov %edx,%ecx 69: 83 e1 1f and $0x1f,%ecx 6c: c1 ea 05 shr $0x5,%edx 6f: d3 e0 shl %cl,%eax 71: 85 44 94 18 test %eax,0x18(%esp,%edx,4) 75: 75 39 jne b0
$ cat test.cpp
int test(int x) {
if (x = 1)
return 42;
else
return 0;
}
$ g++ -c test.cpp
$ g++ -c -Wall test.cpp
int test(int x) {
if (x = 1)
return 42;
else
return 0;
}
Only when we turn on warnings, compiler tell us about a possible error.
Making the parameter const shows us error:
$ cat test2.cpp
int test(int x) {
if (x = 1)
return 42;
else
return 0;
}
$ g++ -c test.cpp
test2.cpp: In function ‘int test(int)’:
test2.cpp:2:8: error: assignment of read-only parameter ‘x’
if (x = 1)
^
All input parameters should be const, all write-once variables serving as a parameters for some computations should be also const.
$ pwd /home/foo/project $ git update-server-info
$ cd .. $ pwd /home/foo $ python -m SimpleHTTPServer Serving HTTP on 0.0.0.0 port 8000 ...
$ git clone http://your_ip:8000/project/.gitStep 1 have to be executed manually when local repository has changed.