errors and casting

J

jacob navia

Bill Cunningham a écrit :

[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.
 
B

Bill Cunningham

[...]
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
 
J

jacob navia

Bill Cunningham a écrit :
[...]
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
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.
 
L

Lew Pitcher

[...]
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.

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.
 
K

Keith Thompson

jacob navia said:
Bill Cunningham a écrit :

[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.

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.
 
B

Bill Cunningham

I have honestly went over and over this and don't see the errors. 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;
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
 
N

Nick Keighley

[...]
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.

try rewriting it in pascal then
 
B

Bill Cunningham

io_x said:
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
 
B

Bill Cunningham

Lew said:
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
 
B

Bill Cunningham

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
 
B

Bill Cunningham

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
 
S

Stefan Ram

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.

»Besides a mathematical inclination, an exceptionally
good mastery of one's native tongue is the most vital
asset of a competent programmer.«

attributed to Djikstra, but I can not confirm the source

»If your writing is semi-literate, ungrammatical, and
riddled with misspellings, many hackers (including myself)
will tend to ignore you. While sloppy writing does not
invariably mean sloppy thinking, we've generally found the
correlation to be strong -- and we have no use for sloppy
thinkers. If you can't yet write competently, learn to.«

Eric Raymond

http://www.catb.org/~esr/faqs/hacker-howto.html#skills4

»I've found that some of the best developers of all are
English majors. They'll often graduate with no programming
experience at all, and certainly without a clue about the
difference between DRAM and EPROM.

But they can write. That's the art of conveying
information concisely and clearly. Software development
and writing are both the art of knowing what you're going
to do, and then lucidly expressing your ideas.«

http://praisecurseandrecurse.blogspot.com/2007/03/english-majors-as-programmers.html
 
M

Malcolm McLean

Picky speakers of English might point out that "I have went" is, um,
"incorrect"?  "non-standard"?
Stigmatised. Adult speakers don't make grammatical errors in their
native language, almost by definition.
 
N

Nick Keighley

Stigmatised. Adult speakers don't make grammatical errors in their
native language, almost by definition.

I suspect only because you define "native language" as the language he
speaks grammatically as an adult.
 
B

blmblm

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.

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 ....
 
J

J de Boyne Pollard

"Software development and writing are both
the art of knowing what you're going to
do, and then lucidly expressing your ideas."

Software development is more the art of knowing what the computer is
going to do. (-:
 
J

Joachim Pense

Am 16.04.2010 19:49, schrieb J de Boyne Pollard:
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
 
M

Malcolm McLean

I suspect only because you define "native language" as the language he
speaks grammatically as an adult.
Are the rules applied consistently (eg if he says "can't hardly" is it
always "can't hardly"), and are they accepted by at least one other
person (does someone else say "can't hardly")?

If so he's speaking grammatically.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top