Memory corruption on freeing a pointer to pointer

Discussion in 'C Programming' started by Sharwan Joram, Aug 23, 2013.

  1. (snip, I wrote)
    It has been a long time since I wrote ALGOL. Does it allow assignment
    in places, such as inside and IF, where it might be confused for
    a relational expression?

    One that I do remember for ALGOL is that it uses IF THEN ELSE
    for the conditional operator.

    I := IF J>1 THEN 3 ELSE 4;
    PL/I uses '0'B and '1'B, bit strings of length one. It allows
    conversion beteen bit (or character) strings and numeric types,

    But also PL/I, like Fortran, has an assignment statement.
    The = in assignment has a differnet meaning from = as a relational
    operator. Multiple assignment is done with , not =.

    -- glen
    glen herrmannsfeldt, Aug 29, 2013
    1. Advertisements

  2. (snip on Fortran = operator)
    Even more, unlike C, subscript and substring are not operators
    in Fortran. You can't subscript a function returning an array
    without assigning the value to an array first.

    -- glen
    glen herrmannsfeldt, Aug 29, 2013
    1. Advertisements

  3. Sharwan Joram

    Tim Rentsch Guest

    It's 7. Just ask Ken Iverson.
    Tim Rentsch, Aug 29, 2013
  4. Sharwan Joram

    James Kuyper Guest

    On 08/28/2013 11:31 PM, Robert Wessel wrote:
    While the percentage of the population that was born or died on April
    1st was relatively insignificant, with a population as large as that of
    the US, it's still a fair number of people. The number being counted is
    still not sufficiently well-defined to justify treating all of the
    digits in the total as significant.
    James Kuyper, Aug 29, 2013
  5. Sharwan Joram

    Martin Shobe Guest

    The rule under discussion is that constants should go on the right when
    being compared to variables or formula that contain them. It's also in
    direct response Ben saying that mathematicians tend to follow that rule.
    As such, I find it a rather convincing rejoinder.
    Of course not, but someone was using a (supposed) mathematical
    convention to justify a particular coding style.

    My personal take on the issue is that the more important of the two
    formulas being compared should be on the left side. On the math page in
    question, pi is the important item, so it should be on the left. When
    programming, the constant is rarely the more important.

    Martin Shobe
    Martin Shobe, Aug 29, 2013
  6. That was me, but I did not want to not justify a coding style. (That
    requires and assessment of pros and cons that probably won't be
    universal, across projects). I was pointing out that mathematicians,
    who could be relied on more than anyone to understand that 0 = x is the
    same as x = 0, don't write such things any way round. There is, it
    seems, a "natural" way which I suspect is related to the subject/object
    asymmetry in English.

    The example page contains several such examples ("the special case r=0",
    "then c=0", "plugging x=1" and so on). The large formulas that Ike
    pointed to are a distraction, because they are not analogous to the C
    tests that sparked this sub-thread. I can't image "hence 0=x" not being
    corrected by a journal editor. Of course here there is no "pro" -- no
    advantage at all to writing it that way round -- only a "con" in terms
    of the mental hiccup is causes.
    That may be it, I don't know. Oddly, the object-oriented syntax
    x.equal_to(0) was criticised (rightly in my view) because it is
    asymmetric, but it probably matches what our brains are doing, when we
    think in English, more closely than a symmetric operator does.
    Ben Bacarisse, Aug 29, 2013
  7. The folks over in comp.lang.fortran have confirmed that Fortran does not
    have a = operator. (I'm not saying you said there was one, but this
    snip comment could be read as not disagreeing with David Thompson).

    Ben Bacarisse, Aug 30, 2013
  8. Sharwan Joram

    Philip Lantz Guest

    Um, have you read about String Theory?
    Philip Lantz, Aug 30, 2013
  9. Sharwan Joram

    Martin Shobe Guest

    I can think of three (two legitimate) reason why "hence 0=x" wouldn't be
    "corrected" off the top of my head.

    1) "0" is either being defined, or we are listing formulas that are
    equal to zero. (Similar to the example page.)

    2) It comes at the end of a sequence of equations where the 0 was
    derived from the left hand side of the previous equations.

    3) The editor missed it. :)
    Or maybe we are just used to seeing it as an operator rather than a
    function call. I can't say I'm particularly fond of equal_to(x, 0) either.

    Martin Shobe
    Martin Shobe, Aug 30, 2013
  10. Yes, I covered that case in my original message, but I didn't think to
    repeat it. It's really not a special case. 0 is simply the symbol
    being constrained by the condition, just a x is in the more usual case.
    Maybe. Not sure I like it even in this case. Without the "hence" I
    think it's more likely to be left alone.
    Ben Bacarisse, Aug 30, 2013
  11. (Confirmed elsethread) you're right. Sorry, brainslip.
    David Thompson, Sep 4, 2013
  12. There were two algols, rather different. algol 60 could be thought of,
    very roughly, as a nicer syntax for nearly Fortran semantics plus
    call-by-name (which proved a pretty spectacular dead-end). algol 68
    was an attempt, partly successful, to combine nearly all known
    semantics into one rather minimalist syntax, philosophically a bit
    like LISP. Except for declarations, pretty much everything functioned
    as an expression (although not always called that) and (unless my
    memory is playing tricks again) that includes using at least a boolean
    assignment -- as I hinted, I don't recall for sure about other types
    -- as a value and thus a predicate.
    Either keywords IF THEN ... FI *or* symbols ( | |: ). Similarly for
    loops and most other things. The keywords are more readable (if you
    know English) but the symbols are more math-y and international.
    David Thompson, Sep 4, 2013
  13. (snip, I wrote)
    I used to have an Algol 58 book near my computer, but not now.
    Some years ago, I used ALGOL-10 on the PDP-10. I don' t know that
    I had a manual for it, though, so I might not have known all the

    -- glen
    glen herrmannsfeldt, Sep 4, 2013
    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.