User Profile

Collapse

Profile Sidebar

Collapse
TripleDES
TripleDES
Joined: Aug 14 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • TripleDES
    replied to encrpt a folder by using C PROGRAMMING
    in C
    Very good advice. But if she just wants a program that encrypts his files, and not necessarily program it herself, there's lots of programs available for free. Even if a very simple cipher like XTEA or RC4 is used, it's not trivial to make a secure implementation....
    See more | Go to post

    Leave a comment:


  • TripleDES
    replied to Is this valid C++?
    in C
    Private inheritance is (or should be) used if you want to use your base class as an implementation detail in your subclass, whereas public inheritance is used to model IS-A, per the Liskov Substitution Principle. This is a prerequisite for being able to use the subclass polymorphically in place of a base. (If you inherit privately you have to explicitly grant friendship to every function and class that wants the same behavior)....
    See more | Go to post

    Leave a comment:


  • TripleDES
    replied to a small java program
    in Java
    You need more logic than is present in a typical ALU. In particular, logic for doing sign-magnitude conversion, round-to-nearest, and the encoding of subnormal numbers as described above.

    It is true that you do not have to implement conversion. My mistake....
    See more | Go to post

    Leave a comment:


  • TripleDES
    replied to a small java program
    in Java
    what if you write this? :)
    [CODE=java]
    int j = 42;
    double d = 55.64;
    double result = d + j;
    [/CODE]...
    See more | Go to post

    Leave a comment:


  • TripleDES
    replied to Is this valid C++?
    in C
    I agree that what you describe is a form of polymorphism, but I disagree that it is the most common form. If you use private inheritance, only the members of Derived (and friends) can use the class polymorphically in place of a Base class.

    Inheriting publicly with the Derived class overriding Base's virtual functions we can use a Base* polymorphically through late binding, and I'd say that's how polymorphism is usually implemente...
    See more | Go to post

    Leave a comment:


  • TripleDES
    replied to a small java program
    in Java
    Of course, but since this is a typical "trick question", wouldn't one expect the answer to be very concise? I know I would.


    Floating point addition is much more complicated than simply doing a bitwise add w/carry and convert to two's complement.

    You have to convert the the exponent from sign-magnitude form to 2's complement without using arithmetic operators. The easiest way to do this would probably...
    See more | Go to post

    Leave a comment:


  • TripleDES
    replied to VC++ VS2005 Object instance pointer
    in .NET
    Actually, this is C++/CLI so it rightfully belongs in the .NET section....
    See more | Go to post

    Leave a comment:


  • TripleDES
    replied to a small java program
    in Java
    if the two variables are of type float or double, you would have to implement IEEE-754-conforming addition without using arithmetic operators. It could probably be done, but the resulting code would certainly not be "a small java program".

    So if the question is: "How do you make a small java program that calculates the sum of two variables without using arithmetic operators?", my answer is: "It can't be d...
    See more | Go to post

    Leave a comment:


  • TripleDES
    replied to Is this valid C++?
    in C
    Thanks for your reply. I realize, of course, that my example code demonstrates questionable design. In general I would not use public inheritance unless I intend to use the base class polymorphically , and certainly not if it doesn't have a single virtual function/dtor.

    Even if my question was only related to the syntax of the using-declaration, you bring up some good points related to class design that I believe more people than...
    See more | Go to post

    Leave a comment:


  • TripleDES
    replied to Valid Call in Java
    in Java
    Looks like a trick question to me, unless you have omitted some code from your example. Otherwise it is not valid Java, since every function must belong to a class....
    See more | Go to post

    Leave a comment:


  • TripleDES
    replied to Is this valid C++?
    in C
    Actually the code is not really supposed to do anything, I just tried to make my code example as concise as possible. The intent is to grant access to the doSomething() method that would otherwise be hidden from a Derived object, like so:

    Code:
    int main()
    {
    	Derived<int> d;
    	d.doSomething(); // <-- calls Base::doSomething(), 
    					 //need a using-declaration for this
    
    	d.doSomething(42);
    ...
    See more | Go to post

    Leave a comment:


  • TripleDES
    started a topic Is this valid C++?
    in C

    Is this valid C++?

    The following code compiles on the latest VC++, not EDG or MINGW.

    Code:
    template <typename T>
    class Base
    {
    public:
    	void doSomething(); 
    };
    
    template <typename T>
    class Derived : public Base<T>
    {
    public:
    	using Base::doSomething; // <-- valid?
    	// or do you have to do this?
    	//using Base<T>::doSomething;
    ...
    See more | Go to post

  • TripleDES
    replied to Struct C
    in C
    It's very easy to make mistakes like that with arrays, often with catastrophic consequences. To avoid such problems, you might want to consider using an std::string instead, unless there's a good reason not to....
    See more | Go to post

    Leave a comment:


  • TripleDES
    replied to pointer problem
    in C
    You can just pass the length of the array as the second parameter.

    Code:
    void my_function(BYTE* input, unsigned int len)
    {
    // do something
    }
    If this is C++ I recommend using a STL container like vector instead of an array....
    See more | Go to post

    Leave a comment:


  • TripleDES
    replied to Error on reallocation of a vector
    in C
    Slight correction: If your T is a class-type the program may crash because the destructor is called on an object that was not properly copy-constructed.

    If your T contains pointers (and a dtor), chances are you also need to make a copy ctor (and assignment operator) that properly creates a deep copy of your object, because vector uses the copy ctor internally.

    Otherwise your T's dtor's will end freeing the same memory...
    See more | Go to post

    Leave a comment:


  • TripleDES
    replied to Error on reallocation of a vector
    in C
    I don't see why this shouldn't work, assuming of course that your vector is an std::vector<T>, where T is a built-in type (like int or long).

    However, if your T is a class-type, the program may crash because the destructor is called on an uninitialized object.
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...