[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] C (was: QA uploads primer)



On Wednesday 17 June 2009, Boyd Stephen Smith Jr. wrote:
> In <200906171751.13989.v13@v13.gr>, Stefanos Harhalakis wrote:
> >int n=1; int main() { int n=n; printf("%d", n); }
> >
> >Hope this clears things.
>
> Yeah, and I don't think you *have* to read the C standard to understand why
> this doesn't work.  Scoping rules are often covered in quick-start guides,
> and they would include the statement that 'a local variable's scope begins
> at the *start* of it's declaration and ends at the end of the containing
> block' with the specific admonition that 'int n = n;' "initializes" n to
> whatever value was at that location before n was initialized, leaving n
> with an unknown, not well-defined value.

Exactly, except from the part that this is "often covered in quick-start 
guides". Of course there can be such guides, but they must be rare since I've 
never seen one.

Same thing for the trigraphs.


Reply to: