Search Results - CodeGuru Forums
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: PredicateNormative

Page 1 of 46 1 2 3 4

Search: Search took 0.06 seconds.

  1. Replies
    11
    Views
    636

    Re: Templated upcast function

    Am I missing something? Why wait until runtime to tell the programmer they have done something wrong? Why not just fail at compile time?




    template <bool canUpCast>
    struct...
  2. Replies
    6
    Views
    543

    Re: Heartbeat Calculation Question

    bpm = (1/tick) * 6000
    bpm = 6000 * (1/tick)
    bpm = (6000 * 1)/tick
    bpm = 6000/tick

    However, if you want to think about it more deeply then, yes, 6000 is implicitly 6000/1, so you are really...
  3. Replies
    6
    Views
    543

    Re: Heartbeat Calculation Question

    Bpm = frequency * 60

    Bpm = (1/tick) * 100 * 60

    Bpm = (1/tick) * 6000

    Bpm = 6000/tick
  4. Re: STL functions shows a segmentation fault.

    I'm with VictorN on this one, the most likely cause is that there is a bug in your code. I've seen this kind of thing before where it works on some machines but not on others. Someone at my work had...
  5. Replies
    27
    Views
    2,000

    Re: passing smart pointer

    Yes, however, as I stated previously:

    If the true terminology was still so well widely known and accepted, there wouldn't be so many varying opinions. The fact is, it may have been well...
  6. Replies
    27
    Views
    2,000

    Re: passing smart pointer

    So, razzle, lets get back to businness... ;)


    You are missing the point, the reason for avoiding dynamic memory allocation in real-time systems, is not always to do with the timing guarantees of...
  7. Replies
    27
    Views
    2,000

    Re: passing smart pointer

    Yeah, that is where I was coming from in post #10. My point being is that it depends on intent, i.e. what is the subject matter?

    But, if you take the strict alias view of reference semantics,...
  8. Replies
    27
    Views
    2,000

    Re: passing smart pointer

    Agreed, however, outside of the context of Stroustrup and the C++ standard (neither of which by the way give any formal definition of the term reference semantics, though both do make statements that...
  9. Replies
    27
    Views
    2,000

    Re: passing smart pointer

    Having spent all the time that I was going to spend replying to the rest of razzles last post, researching the subject of reference semantics, I'm changing my mind - I don't agree with the argument...
  10. Re: Can you think of anything wrong with this code.

    Ok, your post has just shattered my trust in alignment guarantees for non-standard alignment of objects that are not automatic. Although I don't have time now, at the my available opportunity, I'll...
  11. Replies
    27
    Views
    2,000

    Re: passing smart pointer

    Razzle, my apologies for not replying sooner, although I read your post on Saturday, due to a number of commitments, this is the first opportunity I have had to respond. I'm a bit limited for time at...
  12. Replies
    27
    Views
    2,000

    Re: passing smart pointer

    Ok, let's go through these one by one. I'll deal with point 5 first, because it is really important to the context of other things that I'll write in this post.



    There are no other parameter...
  13. Replies
    27
    Views
    2,000

    Re: passing smart pointer

    Agreed. :)
  14. Replies
    27
    Views
    2,000

    Re: passing smart pointer

    There are a few issues with your code.

    1) Do not use leading underscores, the C++ Standard states:

    That basically means if you define variables with leading underscores you are running the risk...
  15. Re: Can you think of anything wrong with this code.

    It would have done, but a few lines down, you will see that I use placement new to copy construct a U to a value_type which is a T, so the type that resides in the allocation is a T type. :)
  16. Re: Can you think of anything wrong with this code.

    I'd never heard of an over-aligned data until today... looks like I haven't read enough of the C++11 Standard! :D

    That's interesting... so if the C++11 allocation functions are not required to...
  17. Re: Can you think of anything wrong with this code.

    Yeah, this is bad, but I believe that both Windows and Linux have atomic read/writes for objects that are of the same size or smaller than a pointer. I really should just mutex protect the variables....
  18. Re: Can you think of anything wrong with this code.

    I'm wondering if the solution to my problem is to make the following changes to my node class?



    template <typename T>
    struct node
    {
    typedef T value_type;

    node()
  19. Re: Can you think of anything wrong with this code.

    Although I find your post helpful, please can you expand upon the part of your quote in bold? I'm not sure that I am correctly understanding what you are saying. It would seem that you are...
  20. Re: Can you think of anything wrong with this code.

    Yeah, I read that before I posted my code... in fact, it was that gotw (well, technically it was Item 30 in Exceptional C++ which is pretty much identical) that prompted my post. I realised that in...
  21. Re: Can you think of anything wrong with this code.

    You haven't missed anything, I've just been a muppet, thanks for pointing out that rather critical error.

    Anyway, your comment has got me wondering why it has worked so far without any issues. I'm...
  22. Re: Can you think of anything wrong with this code.

    Finally locked it down. Under Allocator Members, the Standard states:



    The line in bold clearly prohibits additional padding between array elements (else the storage size would not be...
  23. Re: Can you think of anything wrong with this code.

    Just noticed, under the sizeof section, the C++ standard states:

    This in turn implies that the maximum alignment requirement of T is no greater than sizeof(T). This would make sense since if I...
  24. Can you think of anything wrong with this code.

    As a bit of background, I'll be leaving my current company soon - this is posing as a slight problem to my company because very few software engineers at my company know how to write or maintain...
  25. Re: Will you tell me how badly I wrote small battle-game?

    I'm not entirely sure what you mean when you say "which would be pass-by-referencing name() in my code". However, for clarification,


    const std::string& name() const { return m_name; }

    is...
Results 1 to 25 of 1145
Page 1 of 46 1 2 3 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center