Search:

Type: Posts; User: rudyman

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    14
    Views
    1,572

    Passing by reference Doesn't require the...

    Passing by reference

    Doesn't require the address-of (&) operator when passing a variable
    Doesn't require the dereference (*) operator when changing the value of a reference
    Guarantees the...
  2. Replies
    18
    Views
    2,153

    Yeah. And the point I'm trying to make is, that...

    Yeah. And the point I'm trying to make is, that feature is useless aside from syntactic sugar and it only causes ambiguity and misinterpretation. If the compiler didn't do that, it would see that the...
  3. Replies
    18
    Views
    2,153

    When I use GCC with Dev-C++, it gets interpreted...

    When I use GCC with Dev-C++, it gets interpreted as MyClass(*)(). Either way, the compiler changes the meaning of the code significantly (without telling you) from something that's semantically...
  4. Replies
    18
    Views
    2,153

    I think it's really stupid how the compiler turns...

    I think it's really stupid how the compiler turns a function name into a pointer to a function. It's for that reason that something like this gets misinterpreted as a function prototype instead of a...
  5. Replies
    14
    Views
    2,246

    AFAIK, changing a const variable results in...

    AFAIK, changing a const variable results in undefined behavior and can only be done with unions, pointer arithmetic, const_cast, or placement new.

    Mutable just means a member of a class/struct...
  6. Replies
    6
    Views
    1,548

    Also, unless there's more code that you haven't...

    Also, unless there's more code that you haven't shown, you probably don't need virtual inheritance when deriving class amountnum. The virtual destructor is enough.
  7. Thread: Sarah Palin

    by rudyman
    Replies
    29
    Views
    7,447

    Yeah, choosing Palin was an attempt to win over...

    Yeah, choosing Palin was an attempt to win over some of Hillary's supporters. They sure are masters at what Obama would call silly politics.

    Obama at least knows about Bubble Sort.
  8. Replies
    2
    Views
    5,789

    You have to use a lowercase 'm' in 'main': ...

    You have to use a lowercase 'm' in 'main':


    int main()
    {
    ...
  9. Thread: 1=0.

    by rudyman
    Replies
    61
    Views
    17,349

    The number 1 can be written as 0.999... just like...

    The number 1 can be written as 0.999... just like it can be written as 1.000...
    With that kind of mentality, it's almost like shorthand for a limit:

    The difference between 1 and 0.99 is 0.01....
  10. Replies
    24
    Views
    4,884

    But without the union, how could you initialize...

    But without the union, how could you initialize the array and keep it encapsulated?
  11. Replies
    24
    Views
    4,884

    This is how I do it, at least: class...

    This is how I do it, at least:



    class MyClass
    {
    public:
    union
    {
    const int array [3]; // These both have the
  12. Replies
    24
    Views
    4,884

    You can also use unions to initialize arrays...

    You can also use unions to initialize arrays within classes/structs.
  13. Replies
    24
    Views
    4,884

    Yes. For example, union MyUnion { int...

    Yes.

    For example,


    union MyUnion { int n; double d; };
    struct MyStruct { int n; double d; };


    The union allows you to store an integer OR a double (but not both at the same time). The...
  14. Replies
    15
    Views
    2,002

    Hmm, but that might remove leading 0's.

    Hmm, but that might remove leading 0's.
  15. Replies
    15
    Views
    2,002

    You could return an array and have an (inline)...

    You could return an array and have an (inline) function to print out that array. It may look obscure, unless you want to use dynamic memory:



    // Edited out the solution.
  16. Replies
    9
    Views
    2,301

    Each language is good for different reasons. Java...

    Each language is good for different reasons. Java is the most popular, C is the fastest (typically), Ruby is probably the easiest and most expressive. It all depends on what you're looking for.
    ...
  17. Replies
    33
    Views
    3,421

    References "refer to objects", just like PHP...

    References "refer to objects", just like PHP references.
    Pointers just store numeric memory addresses (which can even be 0, aka NULL), and you must use the dereference operator (*) and the...
  18. Replies
    37
    Views
    4,888

    By the way, ((U - L)/2) is the same thing as (U +...

    By the way, ((U - L)/2) is the same thing as (U + L) / 2.
    Or, better yet, (U + L) >> 1.

    EDIT:
    didn't realize they were doubles
  19. Replies
    4
    Views
    1,482

    If you want to prevent floating-point types, you...

    If you want to prevent floating-point types, you can use template specialization:


    template <typename T>
    class My_Class
    {
    /* ... */
    };

    template <>
  20. Replies
    3
    Views
    1,946

    Your code looks logically correct, except you are...

    Your code looks logically correct, except you are not allocating memory for the second array (hence the seg fault). What you can do instead (in addition to laserlight's suggestion), is use a...
  21. Replies
    2
    Views
    1,244

    I have a class template with two parameters, the...

    I have a class template with two parameters, the second of which is a template template parameter:


    template <typename T, template <typename> class T2>
    class Object
    {
    friend class Object...
  22. Replies
    2
    Views
    1,244

    Alias for class template

    Unfortunately, it's illegal to make a typedef for an incomplete type, like:


    typedef std::vector MyVector; // Illegal!


    Is there any kind of workaround for this without having to use macros?
  23. Construction is a form of initialization, they...

    Construction is a form of initialization, they help create objects of a class. It's actually a special function within the class.

    Private data members make up the inner workings of a class. For...
  24. Replies
    2
    Views
    1,754

    From the looks of that error message, it seems...

    From the looks of that error message, it seems you don't need the word 'new'.
  25. Replies
    36
    Views
    4,327

    Well, if you're passing by reference, the...

    Well, if you're passing by reference, the parameter will be an object (that is, it will already be constructed). You can't call the constructor on an object and probably shouldn't call the...
Results 1 to 25 of 78
Page 1 of 4 1 2 3 4