Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: fscan: about it |
| Date | 2011-11-05 20:12 +1300 |
| Message-ID | <9hk5vgF62fU12@mid.individual.net> (permalink) |
| References | <0636e7d1-01db-4dde-9c89-c84840b9b7d6@hc5g2000vbb.googlegroups.com> <9hj8ovF62fU5@mid.individual.net> <ln4nyjf6l1.fsf@nuthaus.mib.org> |
On 11/ 5/11 07:04 PM, Keith Thompson wrote:
> Ian Collins<ian-news@hotmail.com> writes:
>> On 11/ 5/11 11:41 AM, Pasquale Frega wrote:
>>> Ok, a simple question: can fscan get a simple return with nothing or a
>>> simple escape or anything?
>>
>> I assume you meant scanf?
>>
>>> please try this simple code:
>>> #include<stdio.h>;
>>
>> Don't put a semicolon after an include directive.
>>
>>> #include<math.h>;
>>> int main(void) {
>>> int i;
>>> puts("Enter an int number");
>>> fscan("%d",&i);
>>> printf("You have entered:&d\n", i);
>>> }
>>
>> You really should post something that compiles.
>
> With gcc, it compiles with a couple of warnings. By my reading of
> 6.10.2, an extra semicolon on a #include directive doesn't even violate
> a constraint or syntax rule (but it does have undefined behavior).
>
> The typo "&d" for "%d" doesn't even cause undefined behavior; it just
> prints the string literal and ignores the second argument.
c99 /tmp/x.c
"/tmp/x.c", line 1: warning: tokens ignored at end of directive line
"/tmp/x.c", line 2: warning: tokens ignored at end of directive line
"/tmp/x.c", line 6: warning: implicit function declaration: fscan
Undefined first referenced
symbol in file
fscan x.o
So yes, it "compiles", but it certainly won't produce an executable!
--
Ian Collins
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
fscan: about it Pasquale Frega <zemir_fp@libero.it> - 2011-11-04 15:41 -0700
Re: fscan: about it Ian Collins <ian-news@hotmail.com> - 2011-11-05 11:54 +1300
Re: fscan: about it Keith Thompson <kst-u@mib.org> - 2011-11-04 23:04 -0700
Re: fscan: about it Ian Collins <ian-news@hotmail.com> - 2011-11-05 20:12 +1300
Re: fscan: about it Pasquale Frega <zemir_fp@libero.it> - 2011-11-05 04:47 -0700
Re: fscan: about it James Kuyper <jameskuyper@verizon.net> - 2011-11-05 08:58 -0400
Re: fscan: about it Keith Thompson <kst-u@mib.org> - 2011-11-05 13:28 -0700
Re: fscan: about it Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-04 16:00 -0700
Re: fscan: about it John Gordon <gordon@panix.com> - 2011-11-04 23:57 +0000
csiph-web