#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/socket.h>
struct addrinfo a, *pa;
int stat;
void error(void)
{
fprintf(stderr, "Error: %d\n", errno);
exit(EXIT_FAILURE);
}
memset(&a,'\0',sizeof a);
a.ai_socket = SOCK_STREAM;
a.ai_family = AF_INET;
a.ai_flags = AI_PASSIVE;
17: error: syntax error before '&' token
error: conflicting types for 'memset'
error: conflicting types for 'memset'
warning: data definition has no type or storage class
18: error: syntax error before '.' token
That last error above has me baffled. I have written the error function so I
can call it when an error check proves there's an error.
Bill
[snip]
The truth is that you were "studying sockets" six years ago in
comp.os.ms-windows.programmer.win32 and
microsoft.public.win32.programmer.ole, where you were asking Win32
programmers WinSock-flavoured versions of the questions that you are now
asking Unix programmers. Your postings would have the world think that
you have made zero progress in learning how to compile even basic C
programs in eight years, when you first started talking about how you
were using DJGPP and mingw. Indeed you are trying to convince people
that you have less grasp of things now than you did when you were
talking about recompiling gcc in comp.os.linux.development.apps in 2005,
or about the Standard C library in kernel-mode code in comp.lang.c back
in 2003, or about microkernels in comp.os.linux.development.system in
2002, or about how to use DJGPP in comp.os.linux in 2002, or about Win32
API programming in comp.programming in 2002.
More and more people are not going to fall for this any more. Jens
Thoms Toerring has sussed you. santosh and Mark McIntyre sussed you in
2005. They'll all no doubt be disappointed to learn that it took them
longer than Eric Tomson, who sussed you in 2002 when you asked Linus
Torvalds silly questions on the IETF mailing list.
[...]
> memset(&a,'\0',sizeof a);
> a.ai_socket = SOCK_STREAM;
> a.ai_family = AF_INET;
> a.ai_flags = AI_PASSIVE;
OK if these need to be within a function please note I if I can don't
want them in a function. Maybe a header or .o file.
B
The truth is that you were "studying sockets" six years ago in
Yes, Bill, those four statements *cannot* stand alone outside a function
body.
You are going to have to find a way to /put/ them within a function body
(your choice of /which/ function body) before your program will compile
properly.
--
Lew Pitcher
Master Codewright & JOAT-in-training | Registered Linux User #112576
Me: http://pitcher.digitalfreehold.ca/ | Just Linux: http://justlinux.ca/
---------- Slackware - Because I know what I'm doing. ------
All statements must be inside some function.
--
Keith Thompson (The_Other_Keith) ks...@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
I was about to complain about your posting the above two paragraphs
(which you didn't originally write) without acknowledging the
author. Since the author happens to be someone who deliberately
snips attribution lines, I won't complain about that or identify
the author.
Neverthess, even he doesn't posted quoted text without indicating
that it's quoted text. The above looks just as it would if you,
jacob, had written it yourself; I only realized you hadn't because
I recognized that the writing isn't in your style. Apart from any
other reasons not to do this, it's confusing to your readers.
And you've posted the same thing at least three times in response
to Bill's posts. The point has been made. Please stop before you
exceed the Breidbart Index.
try rewriting it in pascal then
if you can write so difficult english why have you some problem with C?
> In memset's first parameter I even cast a void* and I don't like casts. I
> don't know where the errors are from. I believe I have all the required posix
> standard headers.
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <errno.h>
> #include <string.h>
> #include <netdb.h>
> #include <sys/socket.h>
>
> struct addrinfo a, *pa;
>
> int stat;
> void error(void)
> {
> fprintf(stderr, "Error: %d\n", errno);
> exit(EXIT_FAILURE);
> }
>
> memset(&a,'\0',sizeof a);
> a.ai_socket = SOCK_STREAM;
> a.ai_family = AF_INET;
> a.ai_flags = AI_PASSIVE;
what does it mean "AI_PASSIVE?
> if you can write so difficult english why have you some problem with
> C?
[snip]
> what does it mean "AI_PASSIVE?
AI_PASSIVE is a pre-defined macro used in the posix networking standard
to allow getadrrinfo() to fill in the addrinfo struct with an IP address.
Wether that be IPv6 or IPv4.
http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html
Is a good place to read. Notice this is probably OT here and my question had
to do with ANSI C.
Bill
> Yes, Bill, those four statements *cannot* stand alone outside a
> function body.
>
> You are going to have to find a way to /put/ them within a function
> body (your choice of /which/ function body) before your program will
> compile properly.
I was using code from
http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html#bind
and these members are referred to not in a function. That's what got me.
They must've been written only as an example.
Bill
Picky speakers of English might point out that "I have went" is, um,
"incorrect"? "non-standard"?
Just sayin'.
I guess it might be interesting to know whether there's any correlation
between ability to learn a human language (particularly one learned as
a first language, as English presumably is for Bill C.) and ability to
to express algorithms in a programming language. But to me it doesn't
seem obvious that the first would necessarily imply the second.
[ snip ]
--
B. L. Massingill
ObDisclaimer: I don't speak for my employers; they return the favor.
> Just sayin'.
>
> I guess it might be interesting to know whether there's any correlation
> between ability to learn a human language (particularly one learned as
> a first language, as English presumably is for Bill C.) and ability to
> to express algorithms in a programming language. But to me it doesn't
> seem obvious that the first would necessarily imply the second.
I don't like to say this much because I don't like to use it as an
excuse. But anyway I suffer from some nasty side effects from about 8
medications. They are getting ready to put me on addarall for fatigue and
attention deficit or ADD. So I have some trouble getting things finished and
focusing attention.
Just thought I'd say this.
Bill
> I don't like to say this much because I don't like to use it as an
> excuse. But anyway I suffer from some nasty side effects from about 8
> medications. They are getting ready to put me on addarall for fatigue and
> attention deficit or ADD. So I have some trouble getting things finished
> and focusing attention.
>
> Just thought I'd say this.
And konopin casues me to not be able to concentrate. I am not able to
drive now because I can't remember where I'm going or how to get there. In a
town I've lived in all my life.
Bill
yes i can make wrong if this is the case my excuse
but the "ability to write a human language" has many in common with
"one programming language"
i make grammatical errors in my native language too
I suspect only because you define "native language" as the language he
speaks grammatically as an adult.
Just for the record .... I wasn't intending a put-down here, Bill,
just a nitpicky response to io_x's comment about English. You've
talked before about all those medications and their side effects.
It sounds pretty unpleasant, and I guess you have to cope as best
you can ....
Software development is more the art of knowing what the computer is
going to do. (-:
I think that's not Software development, that's wizardry.
Joachim
If so he's speaking grammatically.
This seems like it belongs in alt.usage.english.
I would say that, in general, if you assert that any speech according
to *a* grammar is grammatical, that reduces "grammatical" to the point
of near-irrelevance. In particular, it removes grammar from the list
of things a language has, because the existence of a pair of people who
use all the same words but don't use them in a way other people can
understand would render them perfectly "grammatical".
To bring this onto the general topic of C: The existence of a compiler
which accepts a particular program does not make that program "valid C".
What's usually at issue is whether we can have reasonable confidence
that C compilers in general would accept something, or even just a future
compiler from the same vendor.
Similarly, what's usually at issue with language is whether you have
reasonable confidence that an arbitrarily-selected native speaker of the
language you think you are speaking will be able to figure out how
to parse your sentences. If they can't, then if you are speaking
grammatically at all, you are speaking a different languauge than they
are hearing.
I tend to view "proper grammar" as rather a lot like "strictly conforming
C". It's not really required most of the time, but there is a HUGE advantage
to the writer in knowing what the rules are, even if the very next decision
you make is that you are going to break them.
-s
--
Copyright 2010, all wrongs reversed. Peter Seebach / usenet...@seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!