Search:

Type: Posts; User: hairyian

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    26
    Views
    3,458

    Parsing is the process of finding out the...

    Parsing is the process of finding out the structure of some source text. For example:



    int foo(int a, int b) {
    return a+b-42;
    }


    To a human, this looks nice and structured. However,...
  2. Replies
    6
    Views
    1,394

    Even worse is the fact that the output is...

    Even worse is the fact that the output is implimentation dependent, and that the putchar line invokes undefined behaviour!

    I'm glad I didn't learn C from someone who hands out such code.

    Ian...
  3. Replies
    4
    Views
    3,975

    Just on a side note, there's another way of doing...

    Just on a side note, there's another way of doing the same thing:

    There's been a few times when I've used a library which required the use of the flat[x+w*y] form but where I've wanted the...
  4. Thread: the main

    by hairyian
    Replies
    9
    Views
    1,408

    In C, you can return any int value you like from...

    In C, you can return any int value you like from main. However, the only ones which have defined behaviour on all operating systems are:

    0,
    EXIT_SUCCESS, and
    EXIT_FAILURE.

    (Those two macros...
  5. Replies
    11
    Views
    1,774

    feof() doesn't do what you think it does... or in...

    feof() doesn't do what you think it does... or in fact, what anonytmous thinks it does.

    feof() only tells you EOF has occured only when some other stdio function (fscanf in your case) has already...
  6. Replies
    7
    Views
    42,616

    For trang: The way you're using scanf is...

    For trang:
    The way you're using scanf is dangerous. If the input is more than 1 character long, then you'll overwrite the array into which you're reading data. You need to specify the length of the...
  7. Replies
    11
    Views
    2,276

    Re: penney,Dave_Sinkula

    In one sense, you are right: the IMPLEMENTATION needs to worry about these things.

    The definition of the C standard does not require that kind of memory model at all - it is a very very flexible...
  8. Replies
    9
    Views
    8,550

    sscanf is slower than doing a direct conversion...

    sscanf is slower than doing a direct conversion because it's a more generic tool. It may be 2 or 3 times slower (or more, or less), depending on your implementation. Profile the code. If you meet the...
  9. Replies
    52
    Views
    8,765

    Hmmm, the most challenging thing to program.........

    Hmmm, the most challenging thing to program......

    Once you get to a certain point there is no such thing as a challenging program. The actual programming is no longer hard, no matter what the...
  10. Replies
    3
    Views
    18,440

    Without seeing the code, it's very difficult to...

    Without seeing the code, it's very difficult to say what's wrong. Even so, here's a guess:

    You have declared a function MyReadProc but not defined it... :)

    In other words, you have something...
  11. Replies
    5
    Views
    2,541

    There's a simple way you can tell whether or not...

    There's a simple way you can tell whether or not you should be using malloc.

    There are only two ways you can have memory allocated: either through malloc and friends, or by declaring a variable....
  12. Thread: if only if

    by hairyian
    Replies
    8
    Views
    1,334

    Reading the environmental limits from C99, a...

    Reading the environmental limits from C99, a conforming compiler must allow at least 127 levels of nested blocks in order to be conforming. This may be larger than that required for C90.

    127...
  13. Replies
    10
    Views
    1,382

    I'd just like to point out that the way programs...

    I'd just like to point out that the way programs loaded and executed posted upthread is not the only way, and in the modern age there are vast differences.

    The entry point of a program does not...
  14. Replies
    19
    Views
    3,086

    Poll: Size and speed are not mutually exclusive. I've...

    Size and speed are not mutually exclusive. I've seen many things which 'should' have been faster by conventional rules when unrolled which, in practice, were not.

    On processors with branch...
  15. Thread: strdup

    by hairyian
    Replies
    4
    Views
    2,993

    That function doesn't free the contents of the...

    That function doesn't free the contents of the node, just the memory allocated to the node structure itself.

    Either:

    a) free the contents of node in the function

    or

    b) free the contents...
  16. Replies
    12
    Views
    1,972

    Note of course that if the computer is in /any/...

    Note of course that if the computer is in /any/ graphics mode or any other text mode this code won't work. It also doesn't work if I have specified a different page to be shown than the first one,...
  17. Replies
    12
    Views
    1,972

    Option 1 #include ... code ......

    Option 1

    #include <conio.h>
    ... code ...
    clrscr();
    ... more code...

    advantages:
    clears the screen...
  18. Replies
    6
    Views
    2,172

    I'd expect so. Array identifies when used in an...

    I'd expect so. Array identifies when used in an expression (except of course as the destination of an assignment) evaluate to a pointer to the first element of the array.

    Ian Woods
  19. Replies
    4
    Views
    856

    The function itself isn't a pointer: it just...

    The function itself isn't a pointer: it just returns one.

    The specification for strcpy is that it copies the contents of one string into another and returns the pointer to the first character in...
  20. Replies
    28
    Views
    6,886

    Poll: That wasn't quite what I was refering to. If...

    That wasn't quite what I was refering to.

    If you go and take a look as MSs website and the promo text for Visual Studio .NET it's quite apparent that they don't even say it compiles C++ /at all/...
  21. Replies
    5
    Views
    1,053

    Re: general c rules

    what's the problem with gets()?

    It's a bug and a security hole in many situations. gets() doesn't accept a length and so will keep writing off the end of the allocated space it's been told to...
  22. Thread: ascii codes!!

    by hairyian
    Replies
    23
    Views
    4,994

    Shame that there are a few errors in the C...

    Shame that there are a few errors in the C reference card. :) Not bad, but a few elementary mistakes. (Case in point: C does not define the sizes of integer types as exact numbers of bits as is...
  23. Replies
    28
    Views
    6,886

    Poll: How's about: o variable length arrays o a...

    How's about:

    o variable length arrays
    o a whole new set of type generic maths functions
    o a new meaning to word 'static' (with a famous quote)
    o a number of new string processing functions...
  24. Replies
    28
    Views
    6,886

    Poll: And why would a technician want to meet system...

    And why would a technician want to meet system requirements? By definition, anything which can be implemented in any programming language on a given platform can be implemented in machine code on...
  25. Replies
    28
    Views
    6,886

    Poll: Importantly, VC++ isn't even a C++* compiler. For...

    Importantly, VC++ isn't even a C++* compiler. For an interesting exercise... can anyone find any documentation on Microsofts site which says that they're VC++.Net offering actually compiles C++*?
    ...
Results 1 to 25 of 44
Page 1 of 2 1 2