Search Results

Search found 7 results on 1 pages for 'pingvinus'.

Page 1/1 | 1 

  • Bitshift in javascript

    - by pingvinus
    I've got a really big number: 5799218898. And want to shift it right to 13 bits. So, windows-calculator or python gives me: 5799218898 13 | 100010100100001110011111100001 13 70791 | 10001010010000111 As expected. But Javascript: 5799218898 13 | 100010100100001110011111100001 13 183624 | 101100110101001000 I think it because of internal integer representation in javascript, but cannot find anything about that.

    Read the article

  • Type hinting in Python

    - by pingvinus
    I'm studying Python after a lot of PHP experience and it would be handy to have type-hinting in Python. Looks like eclipse + pydev doesn't support this. Any suggestions? For example, I want my IDE to show function docstrings and types, when I use it, like: def f(x: int) -> int: r"""Adds 3 to x""" return x + 3 f( #and now IDE shows everything about types

    Read the article

  • Static struct in C++

    - by pingvinus
    Hi, I want to define an structure, where some math constants would be stored. Here what I've got now: struct consts { //salt density kg/m3 static const double gamma; }; const double consts::gamma = 2350; It works fine, but there would be more than 10 floating point constants, so I doesn't want to wrote 'static const' before each of them. And define something like that: static const struct consts { //salt density kg/m3 double gamma; }; const double consts::gamma = 2350; It look fine, but I got these errors: 1. member function redeclaration not allowed 2. a nonstatic data member may not be defined outside its class I wondering if there any C++ way to do it?

    Read the article

  • C++ initializing constants and inheritance

    - by pingvinus
    I want to initialize constant in child-class, instead of base class. And use it to get rid of dynamic memory allocation (I know array sizes already, and there will be a few child-classes with different constants). So I try: class A { public: const int x; A() : x(0) {} A(int x) : x(x) {} void f() { double y[this->x]; } }; class B : A { B() : A(2) {} }; Pretty simple, but compiler says: error C2057: expected constant expression How can I say to compiler, that it is really a constant?

    Read the article

  • C++ function-pointer and inheritance

    - by pingvinus
    In parent class I have function, that operates under an array of functions, declared in child-class, number of functions for every child-class may vary. But since every function uses some object-variables, I can't declare them as static. I've try to do something like this: class A { public: typedef int (A::*func)(); func * fs; void f() { /*call functions from this->fs*/ } }; class B : public A { public: int smth; B(int smth) { this->smth = smth; this->fs = new func[1]; fs[0] = &B::f; } int f() { return smth + 1; } }; But, obviously it doesn't work. Any suggestions?

    Read the article

  • C++ template restrictions

    - by pingvinus
    I wondering is there any way to set restrictions on template class? Specify that every type substituted in template must have specific ancestor (realize some interface). template < class B > //and every B must be a child of abstract C class A { public: B * obj; int f() { return B::x + this->obj->f(); } }; Like = in haskell func :: (Ord a, Show b) => a -> b -> c

    Read the article

1