overwriting memory

Discussion in 'C Programming' started by Robbie Brown, Jan 26, 2014.

  1. Robbie Brown

    Jorgen Grahn Guest

    Yes, it's IME rather common to have a constructor-like convention in C
    code, even though you can't get that nice "if you see a Foo object,
    you can be sure it has been properly constructed" feeling.

    I don't understand your naming convention, though -- there is no
    conflict between function names and struct tags, so why make them
    different[1]?

    /Jorgen

    [1] Not that I make them the same -- I tend to use struct Foo and
    foo_create() or foo_init() or something.)
     
    Jorgen Grahn, Jan 30, 2014
    #41
    1. Advertisements

  2. I use all-caps for a structure, because it shouts IMBIG. It's a sort of
    visual cue that you're dealing with a composite memory object.

    I use all lower-case for functions which depend only on the standard
    library (or on other functions where the source is supplied). I use mixed
    case for functions which depend on non-standard third party libraries,
    which for me normally means a windowing system of some level of abstraction.
     
    Malcolm McLean, Jan 30, 2014
    #42
    1. Advertisements

  3. Robbie Brown

    Ike Naar Guest

    Richard Graeme Riley
     
    Ike Naar, Jan 30, 2014
    #43
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.