Search:

Type: Posts; User: Shade

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    3
    Views
    3,393

    1) Yes. 2) There are pointers. But they can...

    1) Yes.

    2) There are pointers.
    But they can only be used in so called 'unsafe' blocks.

    Like this:


    unsafe
    {
  2. Replies
    13
    Views
    2,249

    You can't initialize members of a base class in...

    You can't initialize members of a base class in the constructor of the derived class.

    Members are initialized in the constructor: nData is initialized in A() (default ctor)

    So you cannot...
  3. Thread: What's better

    by Shade
    Replies
    7
    Views
    1,253

    a linked list is MUCH bigger than an array. Why?...

    a linked list is MUCH bigger than an array.
    Why? Because oft the next and prev pointer (plus the first and last).
    normally you have also a data pointer, that makes
    n*sizeof(your...
  4. Replies
    14
    Views
    14,525

    you are wasting your time. I tried once to...

    you are wasting your time.

    I tried once to optimize bubblesort but the speed depends on the compiler.

    You have to turn on optimization otherwise a
    if(a<b)
    {
    t=a;
    a=b;
    b=a;
  5. Replies
    4
    Views
    1,155

    first of all: kick out that ugly global vars!...

    first of all: kick out that ugly global vars!
    never ever use them

    there is a 'function' (actually it is often a macro) isdigit() in ctype.h

    it's easy to use: you call it with your char as...
  6. Thread: Best Keyword

    by Shade
    Replies
    19
    Views
    2,586

    Poll: The only keyword that we do not need is class...

    The only keyword that we do not need is class
    Because struct is nearly the same as class.
  7. Replies
    2
    Views
    1,495

    I don't have the Standard right here (it's at...

    I don't have the Standard right here (it's at home)

    But function arguments are not evaluated in a defined order. And I don't see any reasons why it should be different with variadic functions.
    ...
  8. Replies
    7
    Views
    5,833

    you can use Improved Console...

    you can use Improved Console which offers you simple graphics. It's not much, but for simple things it works fine :)
  9. Thread: "\n" VS <<endl;

    by Shade
    Replies
    33
    Views
    4,419

    Poll: i use newl - which simply returns '\n' I read...

    i use newl - which simply returns '\n'

    I read some performance issues on gcc2.95
    in which '\n' was 60 times faster than endl - so I thought, why use endl??

    a flush is made when the buffer is...
  10. Replies
    3
    Views
    8,201

    Just an idea: float f=rand()/100.0;

    Just an idea:

    float f=rand()/100.0;
  11. Replies
    21
    Views
    4,913

    That's not a compiler, that's even not a parser!...

    That's not a compiler, that's even not a parser!

    if(!strcmp(str,"MainFunction")) strcpy(str,"main");

    A compiler or interpreter is much more complex!

    Ich think you should read some tutorials...
  12. Replies
    10
    Views
    1,648

    No! in everything is in the namespace...

    No!
    in <iostream> everything is in the namespace std. std is a namespace, not a class!

    ios is a typedef to hide ios_base! (which is a class)

    But there are more differences - the implementation...
  13. Replies
    7
    Views
    1,880

    what if scanf() read EOF? Then getchar() will...

    what if scanf() read EOF? Then getchar() will never return '\n'
  14. Thread: Logical negation

    by Shade
    Replies
    7
    Views
    3,251

    x==0 or x?0:1 No - there is no good...

    x==0

    or

    x?0:1

    No - there is no good way... Why do you ask?
  15. WTF? The STL is template-based, that means, it...

    WTF?

    The STL is template-based, that means, it costs nothing to runtime!!
    Header files only contain declarations!!

    170KB means you compile in Debug Mode.
    Or you have LINKED many libraries.
    ...
  16. Replies
    38
    Views
    6,864

    Poll: You can program OO-Programs in C too :) It...

    You can program OO-Programs in C too :)

    It isn't that difficult.

    But C is (nearly) a subset of C++, so why prefer it over C++? The only reason I can think of is, that no C++ Compiler is...
  17. Replies
    18
    Views
    4,540

    You say, it's a waste of time to use an int if...

    You say, it's a waste of time to use an int if you only need a char. But do you have heard about alignment or padding?

    on 32bit intel systems an int is the fastest thing possible. So everything is...
  18. Replies
    3
    Views
    1,531

    On 32bit intel and amd is 4byte the magic word. ...

    On 32bit intel and amd is 4byte the magic word.

    nearly everything is aligned to 4byte (you get a significant speed plus!)

    so it is simple for optimizing.
  19. Replies
    4
    Views
    1,002

    In the Ctor of your class you can store pointers...

    In the Ctor of your class you can store pointers to the generated object in a list:



    Class::Class(...)
    {
    objects.push_back(this); //objects is a list<Class*>
    ...
    }
  20. Replies
    44
    Views
    180,070

    Sticky: It's funny to read... I think noone will...

    It's funny to read...

    I think noone will change their minds, so why discussing?

    I (and as I see some others) keep doing it like the gurus, and you JoeSixpack keep casting.

    I have learned...
  21. Thread: Casting malloc?

    by Shade
    Replies
    44
    Views
    21,076

    It's funny to read... I think noone will...

    It's funny to read...

    I think noone will change their minds, so why discussing?

    I (and as I see some others) keep doing it like the gurus, and you JoeSixpack keep casting.

    I have learned...
  22. Replies
    44
    Views
    180,070

    Sticky: int* p; p=(char*)malloc(100); so what?...

    int* p;

    p=(char*)malloc(100);

    so what? Compiler says: failure!
    But what is the benefit?

    It's a false sense of security:
    p=(int*)malloc(100);
  23. Thread: Casting malloc?

    by Shade
    Replies
    44
    Views
    21,076

    int* p; p=(char*)malloc(100); so what?...

    int* p;

    p=(char*)malloc(100);

    so what? Compiler says: failure!
    But what is the benefit?

    It's a false sense of security:
    p=(int*)malloc(100);
  24. Replies
    5
    Views
    4,391

    OK, my first solution should be clear: CString...

    OK, my first solution should be clear:

    CString substring = sub_str(temp);

    The second one is more difficult (it is a C Solution :))

    char substring[100];
    sub_str(temp,substring);
  25. Replies
    9
    Views
    2,840

    the syntax for asm isn't always the same (I think...

    the syntax for asm isn't always the same (I think the C++ standard includes a keyword asm, but every compiler has its own syntax)

    for VC++

    __asm {
    xor eax, eax
    }

    or
    __asm xor eax,eax
Results 1 to 25 of 88
Page 1 of 4 1 2 3 4