Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
May 31, 2005 ungetc returns c? | ||||
---|---|---|---|---|
| ||||
Anyone know why ungetc in std.stream returns the input character? I'm thinking of changing that to void ungetc(char c) and void ungetcw(wchar c) |
June 01, 2005 Re: ungetc returns c? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ben Hinkle | In article <d7ipim$12t$1@digitaldaemon.com>, Ben Hinkle says... > >Anyone know why ungetc in std.stream returns the input character? I'm thinking of changing that to > void ungetc(char c) >and > void ungetcw(wchar c) I can't think of any reason I'd want the input character from an unget. I say change it. Sean |
June 01, 2005 Re: ungetc returns c? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | Sean Kelly wrote: >>Anyone know why ungetc in std.stream returns the input character? I'm thinking of changing that to >> void ungetc(char c) >>and >> void ungetcw(wchar c) > > I can't think of any reason I'd want the input character from an unget. I say > change it. It does in C, so I guess that's why it does in D too. SYNOPSIS #include <stdio.h> int ungetc(int c, FILE *stream); RETURN VALUES The ungetc() function returns the character pushed-back after the conversion, or EOF if the operation fails. So it seems the main reason for the return value in C, is to have somewhere quick to return an error code in ? --anders |
June 01, 2005 Re: ungetc returns c? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ben Hinkle | On Tue, 31 May 2005 18:47:47 -0400, Ben Hinkle wrote:
> Anyone know why ungetc in std.stream returns the input character?
char c = stream.ungetc (stream.getc ()); ?
Not sure if it's really important, but it's the only use I see.
|
June 02, 2005 Re: ungetc returns c? | ||||
---|---|---|---|---|
| ||||
Posted in reply to SeeSchloss | "SeeSchloss" <ng@seeschloss.org> wrote in message news:pan.2005.06.01.18.18.51.756416@seeschloss.org... > On Tue, 31 May 2005 18:47:47 -0400, Ben Hinkle wrote: > >> Anyone know why ungetc in std.stream returns the input character? > > char c = stream.ungetc (stream.getc ()); ? > > Not sure if it's really important, but it's the only use I see. OK. might as well keep it the way it is. |
Copyright © 1999-2021 by the D Language Foundation