Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
F

Florin Crisan

@Florin Crisan
About
Posts
42
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Pause / Break
    F Florin Crisan

    Try this article: http://en.wikipedia.org/wiki/Break_key[^]

    Florin Crişan

    The Lounge question

  • What is the syntax of a static int array to array structure?
    F Florin Crisan

    I was about to suggest the code below, but then I've tried it in a compiler and I got an error.

    static int arCombs[6][11] =
    {
    {i1,i2,i3,i4,i5,i6},
    {i7,i8,i9,i10,i1,i2},
    {i8,i9,i10,i1,i2,i3},
    {i9,i10,i1,i2,i3,i4},
    {i10,i1,i2,i3,i4,i5},
    {i1,i2,i3,i4,i5,i7},
    {i1,i2,i3,i4,i7,i8}, // error C2078: too many initializers
    {i1,i2,i3,i7,i8,i9},
    {i1,i2,i7,i8,i9,i10},
    {i1,i6,i7,i8,i9,i10},
    {i5,i6,i7,i8,i9,i10}
    };

    The dimensions are wrong. You are declaring an array of 6 arrays of 11 elements, not an array of 11 arrays of 6 elements. But you only initialize 6 of those 11. The rest get the default value, 0. So the correct way should be:

    static int arCombs[6][11] =
    {
    {i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11},
    {i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11},
    {i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11},
    {i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11},
    {i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11},
    {i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11}
    };

    or even

    static int arCombs[6][11] =
    {
    i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,
    i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,
    i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,
    i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,
    i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,
    i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11
    };

    I just copied and pasted the values, but you get the picture ;)

    Florin Crisan

    C / C++ / MFC help question data-structures

  • selam
    F Florin Crisan

    Hey, it wasn't me who started it... I just didn't want to miss the fun ;)

    Florin Crisan

    C / C++ / MFC

  • selam
    F Florin Crisan

    Pace si prietenie între poporul român si poporul turc...

    Florin Crisan

    C / C++ / MFC

  • Visual studio
    F Florin Crisan

    You're right :-O

    Florin Crisan

    C / C++ / MFC csharp c++ visual-studio question

  • Visual studio
    F Florin Crisan

    Hmm, ".cpp" should be handled by default by Visual Studio. Are you sure you have installed the C++ component of Visual Studio? You can always try running the VS installer and doing a repair... Just my two cents.

    Florin Crisan

    C / C++ / MFC csharp c++ visual-studio question

  • Rich Edit control accepting only numeric values
    F Florin Crisan

    Rich Edit Control Styles:[^] ES_NUMBER Allows only digits to be entered into the edit control.

    Florin Crisan

    C / C++ / MFC

  • Exception Speicfication
    F Florin Crisan

    In brief, don’t bother with exception specifications. Even experts don’t bother. The main problems with exception specifications are that they’re only “sort of” part of the type system, they don’t do what most people think, and you almost always don’t want what they actually do. http://www.gotw.ca/gotw/082.htm[^] http://herbsutter.spaces.live.com/blog/cns!2D4327CC297151BB!149.entry[^]

    Florin Crisan

    C / C++ / MFC c++

  • unmanaged resource
    F Florin Crisan

    Yes, I think that's pretty much the idea. Basically, in this context, 'unmanaged' means anything that is not destroyed/deallocated/uninitialized automatically. In Microsoft parlançe, though, 'unmanaged' means native code, as opposed to native code. (At least that's how I understood it.)

    Florin Crisan

    C / C++ / MFC question performance learning

  • Synchronization and volatile
    F Florin Crisan

    I'm not sure if you got the point, so I'm going to ramble on: The whole idea of volatile is to tell the compiler not to cache the value. On every access, the value should be checked to see if it has been modified by another thread. The old value should not be presumed correct just because the current thread hasn't modified it. Synchronization, on the other hand, is supposed to ensure that no thread is modifying a value while another thread is using it. You wouldn't want the state of an object to change while you are reading it. Hope this helps.

    Florin Crisan

    C / C++ / MFC c++ com discussion

  • Simple C++ Inheritance and Performance
    F Florin Crisan

    CPallini wrote:

    Method overload and method override are two quite distinct concepts, he asked for the former, you're talking about the latter.

    My bad.

    CPallini wrote:

    AFAIK method invocation is always done via vtables.

    I remember reading differently in Stroustrup's book, but it might be just the lack of sleep. I guess it's really up to the compiler's implementer.

    Florin Crisan

    C / C++ / MFC question c++ oop performance tutorial

  • Simple C++ Inheritance and Performance
    F Florin Crisan

    What a mess. It took me so many messages to say so little. :doh: I'm going to get some sleep before the party. Happy New Year!

    Florin Crisan

    C / C++ / MFC question c++ oop performance tutorial

  • Simple C++ Inheritance and Performance
    F Florin Crisan

    Googling around for virtual function calls, I found this research paper[^], but I'm too lazy to read it. Hope it helps.

    Florin Crisan

    C / C++ / MFC question c++ oop performance tutorial

  • Simple C++ Inheritance and Performance
    F Florin Crisan

    I should learn to read the whole message :-O Also do overloaded methods cause performance differences? Well, a normal non-virtual function call has the normal overhead of a, well, normal function call. That is, the arguments are pushed to the stack, the return address is pushed to the stack, etc. (As far as I know) If you have a polymorphic object, in most implementations it keeps a (hidden) pointer to a table of function pointers (known as 'vtable'). So, before making the call, the pointer to the vtable and then the one to the function would have to be de-referenced. (I really don't know how expensive that is; it may be significant on some systems, but probably nothing significant for normal use). However, if the compiler is able to tell the exact type of the object, it won't need to call the function virtually. For example Derived x; x.bar(); // x is a derived -- call Derived::bar() directly Base *x; x->foo(); // is x a Base or a Derived? use the function pointer to be sure If you really think it would make a difference, try it both with virtual and with non-virtual and see what happens. (And let us known what the result was ;-) )

    Florin Crisan

    C / C++ / MFC question c++ oop performance tutorial

  • Simple C++ Inheritance and Performance
    F Florin Crisan

    On second thought (assuming your constructors are not trivial and cannot be optimized away), if you use two classes you would get two function calls: first to the constructor of the derived class, then to the constructor of the base class. But the other function calls should be the same.

    Florin Crisan

    C / C++ / MFC question c++ oop performance tutorial

  • Simple C++ Inheritance and Performance
    F Florin Crisan

    Theoretically there should be no performance difference. The calls to foo() and bar() should be non-virtual in either case. But you can try having a look at the generated assembler code just to be sure. BTW, if it's not a secret, what are you doing so special that you cannot use a virtual function call?

    Florin Crisan

    C / C++ / MFC question c++ oop performance tutorial

  • how can i convert a BYTE value into CString
    F Florin Crisan

    I must say that I am little surprised that it works with a BYTE. Weren't %x and %u supposed to take a (four-byte) integer?

    Florin Crisan

    C / C++ / MFC question

  • how can i convert a BYTE value into CString
    F Florin Crisan

    In your code, bByte is actually a pointer to a BYTE rather than a BYTE. You should have named it better: pbySomethingUseful. p stands for pointer, by stands for byte (b stands for bool, and that one is actually as big as an int). The rest should be a useful name :) So your code should look like: csValue.Format("%x", (unsigned int) (*pbySomethingUseful)).

    Florin Crisan

    C / C++ / MFC question

  • how can i convert a BYTE value into CString
    F Florin Crisan

    Assuming that you want to create a string representation of the number (that is 32 => "32" rather than 32 => " " – space being the character with the ASCII code 32), you can use something like this: CString x; BYTE b = 123; x.Format("%u", (unsigned int) b); // "123" or x.Format("%x", (unsigned int) b); // "7b" You need to convert it to unsigned int because there doesn't seem to be a way to specify a 1-byte integer in the format string. Or, if you feel adventurous, you can try stringstream[^] or The Boost Format Library[^].

    Florin Crisan

    C / C++ / MFC question

  • OnKeyUp()
    F Florin Crisan

    Why not just use keyboard accelerators[^]?

    Florin Crisan

    C / C++ / MFC
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups