DocScrutinizer51 has quit [Ping timeout: 258 seconds]
DocScrutinizer51 has joined #qi-hardware
sivoais has quit [Ping timeout: 256 seconds]
sivoais has joined #qi-hardware
panda|z has joined #qi-hardware
wpwrak has joined #qi-hardware
dandon has joined #qi-hardware
DocScrutinizer51 has quit [Ping timeout: 258 seconds]
gbraad has joined #qi-hardware
gbraad has quit [Changing host]
gbraad has joined #qi-hardware
DocScrutinizer51 has joined #qi-hardware
gbraad has quit [Ping timeout: 245 seconds]
DocScrutinizer51 has quit [Ping timeout: 258 seconds]
kyak has quit [Ping timeout: 258 seconds]
gbraad has joined #qi-hardware
gbraad has quit [Changing host]
gbraad has joined #qi-hardware
DocAvalanche has joined #qi-hardware
kyak_ has joined #qi-hardware
DocAvalanche is now known as DocScrutinizer51
gbraad has quit [Ping timeout: 245 seconds]
gbraad has joined #qi-hardware
gbraad has quit [Changing host]
gbraad has joined #qi-hardware
wolfspraul has joined #qi-hardware
dlan^ has joined #qi-hardware
dandon__ has joined #qi-hardware
dlan^ has quit [Excess Flood]
dandon__ has quit [Ping timeout: 264 seconds]
dandon has quit [Ping timeout: 684 seconds]
dandon_ has joined #qi-hardware
dandon_ is now known as dandon
lkcl has joined #qi-hardware
DocScrutinizer51 has quit [Ping timeout: 256 seconds]
DocScrutinizer51 has joined #qi-hardware
lkcl has quit [Ping timeout: 256 seconds]
lkcl_ has joined #qi-hardware
lkcl__ has joined #qi-hardware
lkcl_ has quit [Ping timeout: 258 seconds]
DocScrutinizer51 has quit [Ping timeout: 256 seconds]
DocScrutinizer51 has joined #qi-hardware
dandon_ has joined #qi-hardware
rz2k has joined #qi-hardware
dandon has quit [Ping timeout: 282 seconds]
dandon_ is now known as dandon
dandon_ has joined #qi-hardware
dandon has quit [Ping timeout: 252 seconds]
qi-bot has quit [Ping timeout: 256 seconds]
qi-bot has joined #qi-hardware
xiangfu has quit [Ping timeout: 257 seconds]
xiangfu has joined #qi-hardware
DocScrutinizer05 has quit [Disconnected by services]
DocScrutinizer06 has joined #qi-hardware
DocScrutinizer06 is now known as DocScrutinizer05
megha has joined #qi-hardware
baba has quit [Ping timeout: 260 seconds]
larsc_ has joined #qi-hardware
zedstar_ has joined #qi-hardware
mirko_ is now known as mirko
Guest19240_ has joined #qi-hardware
wolfspraul has quit [Quit: leaving]
panda|znc has joined #qi-hardware
larsc has quit [Ping timeout: 245 seconds]
zedstar has quit [Ping timeout: 245 seconds]
panda|z has quit [Ping timeout: 245 seconds]
Guest19240 has quit [Ping timeout: 245 seconds]
kyak_ is now known as kyak
kyak has quit [Changing host]
kyak has joined #qi-hardware
kyak is now known as kyak_
kyak_ is now known as kyak
<whitequark>
why is that ASIC miner even a part of qi-hw wiki?..
apelete has joined #qi-hardware
jluis has joined #qi-hardware
gbraad has quit [Quit: Lost terminal]
jekhor_ has joined #qi-hardware
Calyp has joined #qi-hardware
xiangfu has quit [Ping timeout: 256 seconds]
xiangfu has joined #qi-hardware
rz2k_ has joined #qi-hardware
jekhor__ has joined #qi-hardware
qi-bot7 has joined #qi-hardware
xiangfu_ has joined #qi-hardware
qi-bot has quit [Ping timeout: 248 seconds]
xiangfu has quit [Ping timeout: 248 seconds]
jekhor_ has quit [Ping timeout: 248 seconds]
qi-bot7 is now known as qi-bot
rz2k has quit [Ping timeout: 256 seconds]
larsc_ has quit [*.net *.split]
jluis|work has joined #qi-hardware
jluis has quit [Ping timeout: 264 seconds]
kyak has quit [Ping timeout: 256 seconds]
kyak has joined #qi-hardware
kyak has joined #qi-hardware
kyak has quit [Changing host]
larsc has joined #qi-hardware
wolfspraul has joined #qi-hardware
wolfspraul has quit [Quit: leaving]
lekernel has joined #qi-hardware
kuribas has joined #qi-hardware
jekhor__ has quit [Ping timeout: 245 seconds]
unclouded has quit [Ping timeout: 245 seconds]
kuribas has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
kuribas has joined #qi-hardware
MistahDarcy has quit [Quit: Leaving]
zedstar_ is now known as zedstar
zedstar has quit [Changing host]
zedstar has joined #qi-hardware
wolfspraul has joined #qi-hardware
jekhor__ has joined #qi-hardware
newcup has joined #qi-hardware
paroneayea has joined #qi-hardware
pcercuei has joined #qi-hardware
security has joined #qi-hardware
megha has quit [Ping timeout: 264 seconds]
pcercuei2 has joined #qi-hardware
pcercuei has quit [Read error: Connection reset by peer]
uwe__ is now known as uwe_
guanucoluis has joined #qi-hardware
guanucoluis has quit [Ping timeout: 245 seconds]
guanucoluis has joined #qi-hardware
LunaVorax has joined #qi-hardware
kuribas has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
pcercuei2 has quit [Ping timeout: 256 seconds]
guanucoluis has quit [Ping timeout: 252 seconds]
pcercuei has joined #qi-hardware
guanucoluis has joined #qi-hardware
pcercuei2 has joined #qi-hardware
pcercuei has quit [Ping timeout: 245 seconds]
rz2k_ has quit []
pcercuei2 has quit [Ping timeout: 245 seconds]
pcercuei has joined #qi-hardware
apelete has quit [Remote host closed the connection]
pcercuei has quit [Read error: No route to host]
pcercuei has joined #qi-hardware
emeb has joined #qi-hardware
pcercuei has quit [Ping timeout: 256 seconds]
<kyak>
i just discovered the older syntax for function definition: "The parameters are named between the parentheses, and their types are declared before
<kyak>
opening the left brace"
<whitequark>
K&R, yes
<kyak>
i found it more convenient for functions with many arguments, because it is easier to edit and change arguments types
<larsc>
it's horrible, in my opinion
<kyak>
but i wonder hwo portable is it? it is supported by gcc is all i know
<whitequark>
the historical context is that back in the days, everything was `int`.
<whitequark>
so you didn't really specify any types.
<larsc>
I think gcc will tell you that it's bad idea to do this
<whitequark>
(by default, that is)
<whitequark>
return types, argument types, even variable types
<whitequark>
main; is valid C89
<kyak>
gcc just silently "eats" it
<larsc>
kyak: -Wall -pedantic, etc
<whitequark>
(and is equivalent to `int main`)
<wpwrak>
gcc can issue warnings for such things. some old-style definitions can also cause real trouble.
<wpwrak>
e.g., you can declare a function just as extern int blabla(); ("extern" and "int" are both optional, but gcc can complain if you omit the "int")
<kyak>
but how convenient it is! you can say int param1, param2 instead of int param1, in param2
<larsc>
kyak: you can even say param1, param2
<wpwrak>
this would then be compatible with any (!) list of arguments. so you lose all checking and all type conversion as well.
<kyak>
no, i'm only talking about definition.. i understand it is bad for declaration
<larsc>
without any int at all
<kyak>
larsc: do you mean, in old style?
<larsc>
as whitequark everything is an int by default
<larsc>
as whitequark said
jluis|work has quit [Ping timeout: 245 seconds]
<wpwrak>
in a way ... i think pointers were special. not sure how they actually implemented them. they probably assumed that sizeof(pointer) <= sizeof(int)
<whitequark>
wpwrak: =
<whitequark>
int = ptr = machine word
<wpwrak>
and char just became an int
apelete has joined #qi-hardware
<whitequark>
afaik
<kyak>
yep, i use just (param1, param2) in definition. But if i wanted to make them chars, char param1, param2 before the left brace is more compact than (char param1, char param2). Again, i'm only talking about the definition
<wpwrak>
whitequark: ah, there are subtleties. e.g., you could have different kinds of pointers. e.g., if your machine had a memory for numbers and another memory for characters, you'd have quite different pointers
<larsc>
did you know that the c standard differentiates between function pointer size and data pointer size?
<wpwrak>
of course, this sort of architectures is pretty much extinct now
<larsc>
gcc will throw a warning if you assign a function pointer to a data pointer
<whitequark>
larsc: yes, of course
<whitequark>
that's still useful e.g. AVR
<whitequark>
but I'm not sure if it was in K&R C
<whitequark>
dunno about the PDP-7 arch
<kyak>
btw, i like it how how they get through the first chapter (Introduction) of K&R without using pointers at all
<kyak>
the example programs are very simple of course, but still
<larsc>
they get through entire java books without using pointers at all ;)
<whitequark>
don't mention java
<whitequark>
please
<larsc>
probably ruby books as well
<whitequark>
hrm
<whitequark>
you get exposed to indirection pretty quickly in ruby
<whitequark>
a = []; b = a; b << 1; a # => [1]
<whitequark>
at this point people usually come to #ruby-lang and ask questions.
<wpwrak>
having to confront unpleasant truths early helps to strengthen the character :)
<whitequark>
oh exactly
<larsc>
like there is no santa
<larsc>
or easterbunny
<larsc>
to stay in the season
<whitequark>
what season
* whitequark
looks at piles of snow 2m high
<whitequark>
it *is* decemper
<larsc>
you only need to go the nearest supermarket
<whitequark>
*december
<whitequark>
all the clocks are simply wrong
<kyak>
"Call by value is an asset, however, not a liability." - i'm quoting K&R :)
<whitequark>
call by value is pretty much a requirement for any systems programming
<kyak>
whitequark: don't look at my piles! they are mine! mine!
<whitequark>
the first thing they did to haskell in order to adopt it to systems programming (Habit) was to make it call-by-value
<whitequark>
also call-by-name coupled with pervasive side effects is a disaster
<whitequark>
demonstrated by, I think, ALGOL
<larsc>
whitequark: what do you mean by systems programming?
<whitequark>
larsc: that is a broad topic. but if you need to be able to talk directly to hardware, that's systems programming.
<whitequark>
same for manually managing memory.
<larsc>
why do you need call by value for that?
<kyak>
makes me wonder, why C function can't return two arguments - one has to use pointers for that. Why not simple make C a pass-by-reference language then? Especially considering the extensive use of pointers in C
<whitequark>
larsc: call-by-name is essentially lazy evaluation, and most of the aforementioned code depends on side effects being executed in accurate order
<larsc>
ah ok
<larsc>
i see
<larsc>
kyak: I think the biggest problem with that is that you'd need to update the ABI for every single architecture
<kyak>
otherwise, C is pass-by-value for input arguments and pass-by-reference (kind of) for output
<whitequark>
kyak: pass-by-reference?
<whitequark>
C is strictly pass-by-value
<kyak>
whitequark: that's why a said "kind of".
<kyak>
you need to use pointers if you need more than one output
<whitequark>
struct { int a; int b} f()
<kyak>
ok, if you need to scalar outputs
pcercuei has joined #qi-hardware
<kyak>
you understand what i mean, don't suggest me your little tricks :)
<kyak>
also, if it's pass-by-value, what i can't pass the array value?
<whitequark>
because there are no array values
<kyak>
as input
<whitequark>
struct { int a, b; } foo() { struct {int a, b; } foo = { 0, 0 }; return foo;
<whitequark>
}
<whitequark>
gcc is extra helpful here:
<whitequark>
test.c:3:3: error: incompatible types when returning type ‘struct <anonymous>’ but ‘struct <anonymous>’ was expected
<wpwrak>
it's not a trick :)
<whitequark>
clang:
<whitequark>
test.c:3:10: error: returning 'struct <anonymous struct at test.c:2:3>' from a function with incompatible result type
<whitequark>
'struct <anonymous struct at test.c:1:1>';
<wpwrak>
looks like a logical extrapolation from aggregate initializers
<whitequark>
both gcc and clang eat (struct ret) { 0, 0 } in --std=c89
<whitequark>
oh -pedantic suggests it's C99
<larsc>
ah ok
<kyak>
so i can pass arrays by value.. just need to wrap them into a structure?
<larsc>
yes
<whitequark>
yep
<kyak>
am i the only one finding the pass-by-value concept of C inconsistent? I'm talking about inconsistency between inputs and outputs of a function
<wpwrak>
you mean the number of things you can pass in/out ? or what kind of things you can pass in/out ?
<whitequark>
that you cannot have more than one return value?
<whitequark>
yeah, more recent languages all have this built-in
<whitequark>
Lua, Ruby, Python, etc
<whitequark>
Lisp could simply return a list
<kyak>
yeah, i'm talking about the number of outputs
<whitequark>
(actually, Ruby and Python do that, too. it's just Lua who has native multi-return support)
<whitequark>
(R&P also have deconstructing assignment for arrays/tuples.)
<whitequark>
a, b, c = [1, 2, 3]
<whitequark>
or a, b, c = get_multi
<kyak>
yeah, many languages do that.. MATLAB does that
<kyak>
and then there are "exceptions". When you pass an array name to C function, you get the address. I mean, isn't it just another proof that passing by reference would make more sense?
pcercuei has quit [Ping timeout: 256 seconds]
Calyp_ has joined #qi-hardware
<kyak>
and then you can suddenly subscript that value using square brackets.. But hey, it's an address!
Calyp has quit [Ping timeout: 245 seconds]
<whitequark>
square brackets do not exist.
<whitequark>
subscripts, also.
<whitequark>
it is a syntactic sugar for addition.
<kyak>
i see.. sugar is not healthy :)
<larsc>
syntacitc sugar for addication ;)
<larsc>
syntactic sugar for addicition
<whitequark>
addiction?
<larsc>
so you get addicited to using the language
<kyak>
you just can't get that word right, can you? :)
<larsc>
too much sugar
<larsc>
can type anymore
<larsc>
cant
<whitequark>
rofl
<kyak>
do you advise against using square brackets, but rather use pointers?
<whitequark>
kyak: why? it's the same thing
<larsc>
it's not
<whitequark>
if square brackets make your code more clear (they do), use them.
<whitequark>
larsc: how so?
<kyak>
whitequark: dunno, it sound bad the way you said it
<larsc>
whitequark: can't remember ;)
<kyak>
"When you use the type char x[] instead of char *x with initialization, they are completely 100% different."
<whitequark>
um, [] do not mean "subscript" in declaration
<kyak>
but i think in the context of array subscript, they are the same
<whitequark>
that is true, of course. I was only talking about operator [], not the declaration syntax.
<kyak>
well, at least now i start to understand where aware-of-ASCII-only programmers come from. It's clear K&R didn't think of "wide characters" at that time, but so do many developers not think about it now.
<whitequark>
English-centered world.
Calyp_ is now known as Calyp
Calyp has quit [Changing host]
Calyp has joined #qi-hardware
LunaVorax has quit [Read error: Connection reset by peer]
pcercuei has quit [Ping timeout: 245 seconds]
pcercuei has joined #qi-hardware
pcercuei has quit [Ping timeout: 245 seconds]
pcercuei has joined #qi-hardware
pcercuei has quit [Ping timeout: 245 seconds]
<whitequark>
hehe I just learned about the new hotness, FRP
<whitequark>
functional reactive programming
<whitequark>
imagine a verilog simulator. now replace "wires" with "signals", "pins" with "events" and "triggers" with "switches"
<whitequark>
then connect the whole thing to a GUI
<whitequark>
I think the history has just looped.
<whitequark>
we had physical buttons and physical lamps connected by physical wires
<whitequark>
now we have virtual buttons and virtual lamps connected by virtual wires.
pcercuei has joined #qi-hardware
<larsc>
just wait until somebody adds a virtual transistor