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

Search:

Type: Posts; User: James Curran

Page 1 of 52 1 2 3 4

Search: Search took 0.61 seconds.

  1. Replies
    16
    Views
    1,568

    Re: object creation

    {quote]A compiler may optimise by replacing:[/quote]
    That's not an optimization, and the compler has no option. It is a standard alternate syntax. The two forms you cite are the same on all...
  2. Re: One lousy syntax error I cannot fix in a qsort

    #define const elems 12


    This defines a macro named "const" which is equal to "elems 12". I doubt this is what you want. More likely
    #define elems 12 // "elems" = 12
    // or, better
    const int...
  3. Replies
    5
    Views
    3,364

    Re: Problem sorting 2D array

    everywhere you have "char corres[...]", it should be "char* corres[..]".

    int startScan, minIndex, minValue, minimum;


    should be
    int startScan, minIndex;
    float minValue, minimum;
  4. Replies
    8
    Views
    944

    Re: How to allocate objects at runtime ?

    The only possible way:
    class Base {...};
    class DerivedA : public Base {....};
    class DerivedB : public Base {....};
    // etc....

    Base* GetADerived( /* whatever you use to indicate the object */)...
  5. Re: can someone explain the use of a namespace? (NT)

    Namespaces are a way to separate things from different sources. Say you wanted to you two different third-party libraries for your project: Freddy's Functions for the sockets, and Walter's Widgets...
  6. Re: can someone explain the use of a namespace? (NT)

    Namespaces are a way to separate things from different sources. Say you wanted to you two different third-party libraries for your project: Freddy's Functions for the sockets, and Walter's Widgets...
  7. Re: Two Classes with Pointer to each other?!?

    Of course it won't. If A contains a B, how could a B possibly contain an A? Try an experiement at home with a big box labeled "A" and a little box labeled "B" if you still have trouble grasping...
  8. Replies
    3
    Views
    631

    Re: Problem with .txt file

    The scanf()s must account for the newline scanf("%d\n", &num);



    Truth,
    James
    http://www.NJTheater.com
    http://www.NovelTheory.com
    I don't do it for the points (OK, maybe I do), but rating a...
  9. Replies
    2
    Views
    708

    Re: POSIX and regular expressions

    The Boost library (http://www.boost.org) has a regular expression class which handles POSIX expressions. (It also has a very good chance of becoming part of the next C++ standard, so you might want...
  10. Re: Can you give the error of the Code?thank you

    And they already don't translate [ ccode ] tags which aren't acconpanied by [ /ccode ]s, so You'd think not translating [ i ] without [ /i ]s would be a snap.

    Truth,
    James...
  11. Re: Can you give the error of the Code?thank you

    If his code, he frequently used "[ i ]" (without the spaces), to index off of input and buff. These cause the code to change to italics on this forum, instead of being displayed.

    The last 4 of...
  12. Replies
    6
    Views
    831

    Re: Is this legal piece of code

    The last number is printed as negiative because enums are inherently based on signed ints. It should print the correct value by changing the code to:out << endl << (unsigned) my_code8 << endl;
    ...
  13. Replies
    103
    Views
    5,631

    Re: about "const"

    The "v-table" is the standard method of implementing virtual function in C++ (There's not requirement that it's done using one, but I know of no compile that does it differently)

    TO understand...
  14. Replies
    107
    Views
    5,680

    Re: simple question about "static"

    According to the Standard, vector is defined in namespace std.

    However, while compiling a program, the compile does not know about that. It only knows the declarations that it sees. Therefore,...
  15. Replies
    5
    Views
    771

    Re: Date formatting

    You can try the date class I (and a bunch of other people) wrote some time ago.
    http://www.noveltheory.com/download/killerc.htm



    Truth,
    James
    http://www.NJTheater.com...
  16. Replies
    4
    Views
    762

    Re: Buffer overflow?

    (a) mainly, through trial and error.
    (b) You have to understand how CPU stacks work.
    void func()
    { char buff[4];
    /// ... whatever
    }


    By the time execution reaches the "whatever" bit,...
  17. Replies
    2
    Views
    649

    Re: crossreferencing class

    First of all, what you ask is impossible (If a garage (class A) contains a car (class B), how can the car *also* contain a garage?)

    Otherwise, what Igor said is correct (although, it's not...
  18. Re: ***** > operators Char byte concatination to get 12 bit data

    Shift operators are not the right plan here....Try bitfields:union A
    {
    struct B
    {
    short dummy1:1;
    short data:12;
    short dummy2:3;
    } bits;
    char byte[2];...
  19. Replies
    11
    Views
    1,621

    Re: vector

    Funny, It works for me. (Note, you MUST put it before any #include)

    Truth,
    James
    http://www.NJTheater.com
    http://www.NovelTheory.com
    I don't do it for the points (OK, maybe I do), but rating...
  20. Replies
    11
    Views
    1,240

    Re: Overloading global operators?

    Because you are trying to write a oper+ for two native types (char*s). You can no more do that, than you could redefine what operator+(int, int) means.


    Truth,
    James
    http://www.NJTheater.com...
  21. Replies
    11
    Views
    1,240

    Re: Overloading global operators?

    No. At least one of the two operands must be a non-native type (ie, a class).

    String operator+(String, char*); is OK.
    String operator+(char*, String); is OK.
    String operator+(String, String);...
  22. Replies
    11
    Views
    1,240

    Re: Overloading global operators?

    Of course, you can combine strings. Heck, *strings* already have an oper+ defined.

    You just can't combine char*s.


    Truth,
    James
    http://www.NJTheater.com
    http://www.NovelTheory.com
    I...
  23. Replies
    11
    Views
    1,621

    Re: vector

    You can't fix it, you can merely hide it.

    To hid it, put the line#pragma warning (disable:4786)


    before any include file.

    NOTE: Anything placed before #include <stdafx.h> is ignored, so...
  24. Replies
    7
    Views
    1,235

    Re: Bitwise shift

    err..no. Yours only appears simpler because you left out parts. Your linememcpy( buf, &fPi, sizeof( float ) );

    merely replaces my lineb.asFloat = data;

    Mine does it as a simple assignment...
  25. Replies
    11
    Views
    1,240

    Re: Overloading global operators?

    You cannot add two char*s. The only way to fix your example is to make one of them something else (spec. a class).

    Truth,
    James
    http://www.NJTheater.com
    http://www.NovelTheory.com
    I don't do...
Results 1 to 25 of 1299
Page 1 of 52 1 2 3 4





Click Here to Expand Forum to Full Width

Featured