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
A

ARopo

@ARopo
About
Posts
13
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Apparently there is no limit to naming conventions for method
    A ARopo

    I remember some years ago seeing this from one developer

    void CommunicationsBlockScheduler::PerformScheduleAndExecuteOfCommunicationBlocksOnAProportialAndPriorityBasis(..)

    And another developer on the same team took the oposite approach With gems like this:

    void rssr()

    This was replicate spread sheet rows

    The Weird and The Wonderful

  • pdb VC++
    A ARopo

    If you ship release binaries to the customer your code will be optimised and therefore using the pdb file will make no sense. In the past I've logged a callstack to a file when an unhandled exception has occurred by setting a hook into the kernel exception handler the walking the stack. Doing this can give you a stack in hex (though functions are often missing due to optimisation). You can then decode the stack information using a map and cod files generated at build time giving you the line in the code that caused the exception.

    C / C++ / MFC tutorial announcement c++ sales

  • Enter button not working on CBitmapButton.
    A ARopo

    This if I remember correctly is exactly how it should behave. On a Dialog pressing enter will 'click' the dialog's default button, otherwise you will need to handle WM_KEYUP and trap VK_ENTER

    C / C++ / MFC help

  • Deliberate Crash
    A ARopo

    Actual the code for catching the access violations was pretty good, It logged a snap shot of the callstack to a file, then using witchcraft .map and .code files you could find and fix the problem back at base without having to reproduce the problem.

    The Weird and The Wonderful sales announcement lounge

  • Deliberate Crash
    A ARopo

    Perhaps you've hit upon an idea for a new message board 'Coding Confession Box'

    The Weird and The Wonderful sales announcement lounge

  • Deliberate Crash
    A ARopo

    On the Plus side this was easy for me to fix.

    The Weird and The Wonderful sales announcement lounge

  • Deliberate Crash
    A ARopo

    Once back in the early 90s when internet connections were not so common. I was working on some general exception trapping in an application written in C, to test it I added something like this to startup code of the application

    int* ptrDummy = NULL;
    if (*ptrDummy == 0) /* this causes an access violation*/

    Having finished that I checked it in to the main product code which got build into a special release for a customer who had had some problems with the software. An engineer was sent from our office in the uk to the customer in the South of France with the software on a CD. The engineer then installed it on the customers system, ran it up in frount of the customer only to discover that it crashed on startup. Sorry engineer.

    The Weird and The Wonderful sales announcement lounge

  • WM_QUERYENDSESSION problem on C++ Builder 2010
    A ARopo

    I had a simular problem and had to check for 2 messages WM_ENDSESSION or WM_QUERYENDSESSION. Then set a flag to indicate shutdown, this flag was then used in an OnClosing event that by default cancelled the close to minimize to the system tray

    C / C++ / MFC help c++ tutorial question

  • Go to Hell
    A ARopo

    no point, but it doesn't do any harm other than making the code slightly less readable. Also no need to call Equals directly could call ==

    The Weird and The Wonderful csharp com sales tutorial question

  • Go to Hell
    A ARopo

    Does that compile? or should it be public bool IsMatched(string str). If it is a bool then this function does the same as if (str=="Customer") maybe they wanted to write

    public bool IsCustomer(string str)
    {
    return (str=="Customer");
    }

    The Weird and The Wonderful csharp com sales tutorial question

  • Wrong on so many levels
    A ARopo

    Sometime you can get odd rounding errors when dealing with high precision, but sprintf a float into a buffer and you're more likely to introduce rounding errors, %f usually defaults to 6 decimial places

    The Weird and The Wonderful performance

  • Wrong on so many levels
    A ARopo

    what I really admire about this is the somewhere it was called and tested like this

    if (IsNegative(flVal))

    instead of

    if (flVal < 0)

    though you could argue that the IsNegative function makes it clear to read at the calling end but then you could write the function like this

    BOOL IsNegative(float flVal) { return (flVal < 0); }

    The Weird and The Wonderful performance

  • Wrong on so many levels
    A ARopo

    BOOL IsNegative(float val) {
    char buffer[10];
    char* ptr;
    char* strptr;

    ptr = buffer;
    sprintf(ptr, "%f", val);
    
    strptr = strstr(ptr, "-");
    if (strptr == NULL)
    	return FALSE;
    if (\*buffer + (strptr-ptr) == '-')
    	return TRUE;
    return FALSE;
    

    }

    A friend posted me this when he worked in the finance sector. I recreated it from memory and I'am sure it was slightly worse than this.

    The Weird and The Wonderful performance
  • Login

  • Don't have an account? Register

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