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

Search:

Type: Posts; User: monarch_dodra

Page 1 of 80 1 2 3 4

Search: Search took 0.09 seconds.

  1. Replies
    5
    Views
    190

    Re: initializing a POD bitfield struct

    Nice link.



    Thank you very much (both). That was a real complete and helpful answer.
  2. Replies
    5
    Views
    190

    Re: initializing a POD bitfield struct

    Well, S isn't necessarily something I own. And if at all possible, I'd rather it stay a POD.
  3. Replies
    5
    Views
    190

    initializing a POD bitfield struct

    I'm wondering what is the "best" way to initialize a bitfield struct. I have this bitfield, defined as:


    struct S
    {
    unsigned int a : 1;
    unsigned int b : 1;
    };

    If I'm "using" the...
  4. Re: Pasting "-" does not give a valid preprocessing token

    Interesting. Good point.



    Ah... Now THERE is a good solution... Unfortunately, I gave you a reduced use case. Inside actual code, the "-" is (potentially) at call site:


    std::cout <<...
  5. Pasting "-" does not give a valid preprocessing token

    I'm porting a macro from VS to GCC. The macro is pretty trivial: Take A and B, and create "A-B":


    #include <iostream>

    #define QUOTE1(A) #A
    #define QUOTE2(A, B) QUOTE1(A##-##B)

    int main()
    {
  6. Replies
    6
    Views
    587

    Re: Struct with internal linkage

    That'd be my "go to" solution, if it was legal C++.

    GCC gives:
    error: a storage class can only be specified for objects and functions

    VStudio compiles, but emits:
    warning C4091: 'static ' :...
  7. Replies
    6
    Views
    587

    Re: Struct with internal linkage

    Derp.

    Thanks.
  8. Replies
    6
    Views
    587

    Struct with internal linkage

    Hi all (long time no see)

    I've been wondering about something for a while:

    Is it possible to declare a struct/class, in a cpp file, designed for local use, but with internal linkage?

    The...
  9. Replies
    4
    Views
    402

    Re: A question regarding try/catch

    You could try the "update the return value as you go" scheme:



    ReturnType foo()
    {
    ReturnType return_val = a;
    try{
    return_val = b;
    if...
  10. Replies
    25
    Views
    1,439

    Re: Best Variable to Use

    I wanted to add to always, always, be very very careful with values "that can only hold two states". Unless your variable actually holds a representation of "true/false", more often that not, it ends...
  11. Replies
    3
    Views
    397

    Re: fstream problems

    http://www.cplusplus.com/reference/iostream/fstream/fstream/

    "app (append) : Set the stream's position indicator to the end of the stream before each output operation."

    You want ate:
    "ate (at...
  12. Replies
    6
    Views
    1,076

    Re: template classes and inline methods

    In this case "MyConst" will probably get inlined anyways, but imagining that MyConst was complex, then the usual method is to create a "non template X" where x is one of:
    a)Base class
    b)Standalone...
  13. Replies
    51
    Views
    3,508

    Re: Interview Questions

    Your logic is wrong. I agree with 1 and 2, but 3 is in direct conflict with 2.

    By making all your methods virtual, you are allowing users to "hijack" them by over-riding them. Once you have...
  14. Re: Compiler auto correct uninitialized variable? (gcc does and VC++ doesn't)

    No:
    "in the 2nd case the value of the char dlm will be set only when the if statement holds true".
    "otherwise it should be undefined": "undefined" is not a special spectral value that crashes a...
  15. Replies
    6
    Views
    483

    Re: rename_file vs move_file

    I wish, but this current project has the following restraints:
    1) No templates due to compiler limitations.
    2) No non in-house code.
    EDIT: 3) No exceptions.
    :(

    It's basically "C with classes...
  16. Replies
    6
    Views
    483

    Re: rename_file vs move_file

    Hum...

    Move it is then!

    Thanks
  17. Replies
    6
    Views
    483

    rename_file vs move_file

    I am writing a little OS agnostic library for my team for manipulating files.

    One such function is used to move/rename files (only files, not dirs). I got into a little argument with a colleague...
  18. Replies
    3
    Views
    312

    Re: find a type based on value ?

    Why wouldn't it?
  19. Replies
    6
    Views
    699

    Re: Subclassing from std::exception

    Rule of thumb:
    *If it starts with an underscore, then it is not standard.
    *If it starts with 2 underscores, then it is not standard, and compiler specific.
  20. Re: Public and private functions with no class?

    If they are templates, then everything goes into .h files. There will be no .cpp file, unless you have parts that don't depend on a parametrized type.

    The standard thing to do is usually to put...
  21. Re: change behaviour of a template class depending on the type ?

    To give you a quick answer: Yes, but it is complicated. You want to search for either "traits" (general solution), or, in your particular case: SFINAE.
  22. Re: More readonly/const stuff: std::string vs const char

    Toying with the allocator would only defer the problem to later, once you are handling strings with incompatible allocator types.

    As laserlight said, why not just declare your objects as...
  23. Re: Custom (readonly) container and iterators ?

    Interchanging iterators creates undefined behavior, simple as that. What's to keep you from checking during debug that the iterators came from the same object? All you need is to keep a pointer to...
  24. Re: Custom (readonly) container and iterators ?

    Nobody in their right mind would write code like this. Besides, standard containers would have exactly the same problem.

    Just FYI, what you want is not strictly a container since the object does...
  25. Re: Running certain code in codeblocks sets off AVG?

    There are many different files that are involved in the construction of a final product, your "main.exe", or whatever your project is called. That's the only file AVG is having problems with, and the...
Results 1 to 25 of 2000
Page 1 of 80 1 2 3 4


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center