lol
come on, I need one of the C pedants
Zhivago?
C pendants ?
I already told you
the unspecified behavior is the implicit cast from void * to a function pointer
i don't know
Meh
that is a lot better than I thought possible in C though
I haven't studied whatsoever today..
what is ?
you can get full closures with some ABI specific assembly
the code he posted http://paste.lisp.org/display/44085
heh
why did you ask if that was standard C bsmntbombdood
because it might not be
it isn't...
prove it
isn't this your code ?
I told you
the void * ’ function pointer cast
yes
present the relevant passage from a C standard, then
I dunno the page
how long have you been coding C
because iirc void* can be cast to any pointer
i don't konw
okay..
5 years, maybe
why?
no reason
where is Zhivago anyway
he's having fun
today is friday for god sake
he's in a table dance having fun you know?
instead of dealing with lots of C noobs right now. good deal.
A pointer to an object or to void may be cast to a pointer to a function, allowing data to be invoked as a function (6.5.4).
do you know nc ?
thats K.5.7 Function pointer castsa in Implementation-defined behavior
so this is valid but not portable
i'm more worried about the legality of executing malloc'd memory than the cast
so I was wrong about that
no worries. nothing that a bullet to the head can't fix
today is saturday.
hi Zhivago
it's portable to posix systems, since posix supplies the required guarantees.
did you party Zhivago- ?
it is not legal in ansi C.
on posix systems, see mmap and mprotect.
please rewrite that sentence correctly.
Did you stand on top of a table drunk last night, zhi ?
(Well.. not in
what is a table drunk?
It was a question not a sentence..
Did you party last night ?
what is a "question not a sentence"?
last night I went out, yes.
please learn how to punctuate your sentences.
he's in a table dance having fun you know?
;o
Zhivago-: i know how to punctuate my sentences.
I can include a full typedef struct declaration in a header file right?
then demonstrate this when you write them.
I already have
your question is malformed -- please try again.
did you party Zhivago- ?
please rewrite that sentence correctly.
It was a question, and not a sentence.
Zhivago, if I can include a typedef struct MyStruct { int i; } MyStruct; in a header file so other programs can access it too
please look up the words 'sentence' and 'question'.
Jesus christ
sure.
please do not advertise your fantasies here.
fantasies ?
woo-hoo! Southwind's up to 16th in the rankings, and still two full points ahead of the Madison Scouts!
video games can translate to terrible grades http://www.sciam.com/article.cfm?alias=video-games-rob-reading-h&chanId=sa003&modsrc=reuters
that's not surprising to me
hrmm, daylight
what is wrong in doing a header file like this? http://pastie.caboo.se/76802/text
I get rss_parser.h:9: error: syntax error before ‘*’ token
you have incorrectly declared RssData
in your example, RssData is an object, not a type
oh, i was going to say you need a typeddef, but there it is
apologies
sanmarcos, where is xmlChar defined?
Zhivago-: why not?
FatalError, in rss_parser.c (an include), but I dont think thats an error
the only thing wrong with the code you pasted is xmlChar isn't defined
sanmarcos, so in other words the header is included after you define it?
otherwise it's valid
that fixed it
hi
is 4294967295U portable
that's 2^32-1
and use ULONG_MAX or something?
make it LU, then sure
because ULONG_MAX might not be 4294967295
ah U is just for unsigned int
oh you want the actual value
LU is unsigned long
funnily enough, yes
right
Hey all
Does anyone know how I could get a cpu usage percent and network usage percent?
(I'm on OpenBSD)
try asking in #openbsd
anybody have any experience writing fuse modules?
netstat
uptime
ifstat
I am going to do a few lines today
damn mang hook it up
good shit?
i'll bring da hookers
yes
lol
I have a string like "/string" how can I take out the /?
increment the char-pointer to the string.
how?
char* s = "/string"; s++;
s then points to "string"
thanks
anyone know what header CPUSTATES is in ?
no such macro exists in the standard.
man, the FUSE documentation is shit
When you read a block of data from a file, what is the significance of using unsigned char * vs just char * ?
unsigned char doesn't sign it
char might be signed, so might have trap representations, so isn't appropriate as a container for arbitrary bytes of data.
right, just trying to get my head around -why- I have an unsigned version of a raw read ... suspecting because I'm trying to get in high-ASCII chars
so unsigned is the only safe way to read data whose written structure isn't known, or whose structure is known but a different implementation wrote the data.
uso unsigned is the only safe way to read data whose written structure isn't known, or whose structure is known but a different implementation wrote the data./u
sad/annoying thing is that it doesn't segfault on any of the testplatforms here
but reliably/repeatably segfaults on one machine with the same test every time
In all fairness, I sincerely appreciate the repeatability
at least it's a better starting point than some 'random segfault'
ARRRUGH.... I've got to be blowing a stack or something here... there's just no valid reason for this thing to be segfaulting
have it pasted anywhere?
code is about 70,000 lines... not practical
what is the code?
It's a commercial app
what is it supposed to do?
it's for webmail hosting management
anyhow, something about the way I'm compiling it doesn't seem to agree with what this client's machine wants - though all very curious
inflex, but surely it's broken up enough that you can isolate the error to a few thousand/hundred lines?
you'd think that 70000 lines of code would be broken up in to separate projects or at least distinct, separate components
it is
the trouble though is that the cause of the instability would appear to come from somewhere further up the chain than just within the given function that it fails
inflex, right. Probably what I would do is start at the bottom and attempt to isolate where in the stuff "above" the bug appears to be coming from, then follow the link up so to speak, and repeat until I reach the source
Yes, it's just that it takes a LOOOOONG time to get stuff up/down from the client's machine, we're talking about working on a line with 3000mS pings and 1K up/download --- it's GREAT
uYes, it's just that it takes a LOOOOONG time to get stuff up/down from the client's machine, we're talking about working on a line with 3000mS pings and 1K up/download --- it's GREAT/u
moin
hey anyone can give C site where is much sources? I just cant find any, i mean i see some codes but damn theyre like truely randomly, codebeach.com owns but no C whyy
aa^way: sourceforge
google filetype:c
cant find anything good but i know there was lang:c example what worked but i looked most of things already
hey all
printf("Load AVG: %d \n", system_info.load_avg[i]);
okay. how do you know it is wrong?
warning: int format, pointer arg (arg 2)
how do I dereference that properly?
how is it declared?
there you go. the usual way is with *
twkm, where exactly (I'm quite new with pointers in C )
omg
cant beleive it i found so perfect site
what expression has pointer type?
Frasha, double load_avg[NUM_AVERAGES];
twkm, * ?
aha, try using %f for the format
seems fairly silly.
sigh. * is a prefix operator that applies to a pointer expression. so find a pointer expression, and put it on the left.
what does? using a floating point format specifier with a floating point argument?
i'll take the compile error over the supposed declaration any day.
as well as using %f
using %f will just change it to "double format, pointer arg".
hmm no
not if . worked.
struct system_info system_info;
get_system_info(&system_info);
%d \n", *system_info.load_avg[i]); that cant be right because its not a pointer...
(i is 0-2) btw
did you try %f as the format specifier then?
yet your compiler thinks it is. figure out why it thinks that.
Frasha, the %f fixed it, heh :P
yep, the compiler gives a misleading error then
and the code seems to work now
Frasha, strange it would do that
did you use the * too, or just change to %f?
i'd assume the reference to a pointer is the array, which is wrong twice over, but i've seen similar warnings before
twkm, just change
poke your compile host with a stick too.
since obviously, it's an array and not a pointer, and you're indexing into it, which gets further away from pointer-ness
void bargraph(struct system_info *si, struct gpio_pin_op *op[]) op is an array of struct gpio_pin_op
am I stating that arg correctly?
and how do I pass it in? &op ?
take out either the * or the []
and if you have it declared as some [x] or *, then just passing it will work
its declared like struct gpio_pin_op op[8]; so its not a pointer
so I need &op, correct ?
no, just pass op
ok
thanks
and the function can declare that parameter as * or [8] or []
what does * front of function name? char *test(char *ptr) ? i notice i cant return pointer when i use *test instead of test, and instead of returning *pointer i have to do return pointer; ?
aa^way: it means what it always means.
aa^way: test() given that declaration would return a pointer to char, so if you have a variable that is the same type and you're returning it, you don't need *
just return var; will work, in other words
aa^way: since test is a function it means "the return value is" ... pointer to char.
wow
i just found all the Cosmos episodes
http://adamroan.livejournal.com/11704.html
oops
well i guess the link is there too
http://joox.net/cat/392/id/1265758
what is cosmos?
one of the best host series ever made
you know, carl sagan
the guy who wrote the Contact etc.
hey look, off topic and theft in one go.
About time that guy got banned. He's been trolling for about 3 days now
sorry i didn't notice it earlier.
i definiatly need to get new compiler, whatever example i take, it just wont compile
aa^way: example?
well yea i look files in google and try them to compile and later i just see how it works
aa^way: not too surprising, the intarweb is filled with crap.
cant find wi nsock.h"
winsock.h*
if you don't have that header, it's not the compiler's fault, you just need to get that header and put it in the place where your compiler looks for such things
hmm.. still no cmpxchg16b support in vc2008.
is there in gcc?
gcc supports inline asm, so yes. probably has an intrinsic func for it by now too
vc supports inline assembly too, though, so i'm not sure i get what you mean by support
gcc supports like 3 different styles of inline assembly. It's a pain keeping them straight.
http://pastebin.ca/607006 my problem is that its the first case that is always being evaluated...
oh.
wait, I know the problem
cmpxchg16b is a x64 instruction, vc lacks inline asm in its x64 compiler
i wonder what bonehead thought to exclude inline assembly
does the documented __sync_val_compare_and_swap not work?
I don't think I've ever seen something called x64 before.
technically they call it x86-64, but whatever
x86_64 is the most common I've seen.
Of course, you could have been referring to IA-64, but that's unlikely.
given the x, i assumed it was a lazy notation
"x64" is most common on windows, from what i've seen.
it's the terminology ms uses.
Ah.
uh.
microsoft means x86_64 when they use x64. itanium is what they say when they mean itanium / ia-64.
indeed
hello room, i have a log.txt file full of text line by line. I can make it read the log.txt, but when i try to read them line by line using and displaying them random line, it failed. Any suggestion?
JohnC-, pastebin your code
you need something like
er
ok
JohnC-, how are you getting the random number
i'll pastebin
ok...I think I know what it is.
perhaps you aren't rounding the random number to an existing line number
kcbanner, http://rafb.net/p/iQxlqk41.html
not sure....make sure that you rounnd your random number to a line that exists
g2g
Hello
How can i kno (in bytes) the size of a file ?
man 2 stat
Okay
You have to be careful. Some *nix require you to use stat64 and friends because off_t is a 32 bit quantity on those systems.
I quite noob i think
I'll move slowly ^^
mm else use ftell
|Steve| o.o
What?
hello I want to make a macro with a #warning inside like this:
#define function() #warning "not implemented"
you cannot.
oh...
do I have to make a real function???
that would be one solution.
gcc has a deprecated attribute but not a "not implemented" attribute.
what about an inline function with only the #warning line?
i guess you don't quite understand when #warning is handled.
The preprocessor is what spits out the warning message.
If you have #warning anywhere not guarded by #if and ilk, the preprocessor will output a warning.
yes |Steve| I know
oh
sorry my mistake I'm thinking about that just now :|