code logs -> 2014 -> Sat, 27 Dec 2014< code.20141226.log - code.20141228.log >
--- Log opened Sat Dec 27 00:00:54 2014
00:12 gnolam [lenin@Nightstar-afpphi.tbcn.telia.com] has joined #code
00:12 mode/#code [+o gnolam] by ChanServ
00:21 himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds]
00:30 gnolam [lenin@Nightstar-afpphi.tbcn.telia.com] has quit [[NS] Quit: Z?]
01:26 Thalasleep is now known as Thalass
01:27 mode/#code [+o Thalass] by ChanServ
01:54 celticminstrel [celticminst@Nightstar-jeiu0g.dsl.bell.ca] has joined #code
01:54 mode/#code [+o celticminstrel] by ChanServ
02:39 Checkmate [Z@Nightstar-484uip.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
05:14 himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code
05:14 mode/#code [+o himi] by ChanServ
05:29
<@macdjord>
simon_: Do you want to get your favorite charity investigated as a drug front?
05:54 Kindamoody[zZz] is now known as Kindamoody
05:56 * celticminstrel writes an std::accumulate function, then realizes that std::count_if is in fact more suitable here.
06:00
<@Alek>
of course! who doesn't?
06:58 celticminstrel [celticminst@Nightstar-jeiu0g.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
07:05 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving]
08:01 macdjord [macdjord@Nightstar-c0i1dq.cable.rogers.com] has quit [[NS] Quit: Tekeli-li! Tekeli-li!]
08:01 Checkmate [Z@Nightstar-484uip.cust.comxnet.dk] has joined #code
08:02 mode/#code [+o Checkmate] by ChanServ
08:55 Kindamoody is now known as Kindamoody|afk
11:45 gnolam [lenin@Nightstar-afpphi.tbcn.telia.com] has joined #code
11:45 mode/#code [+o gnolam] by ChanServ
--- Log closed Sat Dec 27 12:02:05 2014
--- Log opened Sat Dec 27 12:09:45 2014
12:09 TheWatcher [chris@Nightstar-ksqup0.co.uk] has joined #code
12:09 Irssi: #code: Total of 39 nicks [18 ops, 0 halfops, 0 voices, 21 normal]
12:09 mode/#code [+o TheWatcher] by ChanServ
12:10 Irssi: Join to #code was synced in 43 secs
--- Log closed Sat Dec 27 12:16:37 2014
--- Log opened Sat Dec 27 12:17:26 2014
12:17 TheWatcher [chris@Nightstar-ksqup0.co.uk] has joined #code
12:17 Irssi: #code: Total of 39 nicks [18 ops, 0 halfops, 0 voices, 21 normal]
12:17 mode/#code [+o TheWatcher] by ChanServ
12:17 Irssi: Join to #code was synced in 73 secs
12:50 gnolam [lenin@Nightstar-afpphi.tbcn.telia.com] has quit [Connection closed]
12:51 gnolam [lenin@Nightstar-afpphi.tbcn.telia.com] has joined #code
12:51 mode/#code [+o gnolam] by ChanServ
12:55 gnolam_ [lenin@Nightstar-afpphi.tbcn.telia.com] has joined #code
12:56 gnolam [lenin@Nightstar-afpphi.tbcn.telia.com] has quit [Ping timeout: 121 seconds]
13:04 gnolam_ is now known as gnolam
13:04 mode/#code [+o gnolam] by ChanServ
13:08 Checkmate [Z@Nightstar-484uip.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
13:23 gnolam [lenin@Nightstar-afpphi.tbcn.telia.com] has quit [[NS] Quit: No Ping reply in 180 seconds.]
13:26 gnolam [lenin@Nightstar-afpphi.tbcn.telia.com] has joined #code
13:26 mode/#code [+o gnolam] by ChanServ
13:51 Checkmate [Z@Nightstar-ev6.6um.94.83.IP] has joined #code
13:51 mode/#code [+o Checkmate] by ChanServ
15:15 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has joined #code
15:15 mode/#code [+qo Vornicus Vornicus] by ChanServ
15:46 Thalass is now known as Thalasleep
16:46 celticminstrel [celticminst@Nightstar-jeiu0g.dsl.bell.ca] has joined #code
16:46 mode/#code [+o celticminstrel] by ChanServ
17:43
<@celticminstrel>
Is it silly to have a plain array whose element type is an std::array?
18:17
<&McMartin>
It feels a little bit dodgy unless there's a very specific need for it like a C interface that expects an array of void *s.
18:22
<@celticminstrel>
Well, I wanted to be able to treat the inner array as an STL container but had no need to do the same for the outer array.
18:22
<@celticminstrel>
It might later be changed to vector.
18:24
<&McMartin>
It's better to be STL all the way down
18:24
<&McMartin>
As a rule when writing C++ these days it's better to only use C-style things when forced
18:24
<@celticminstrel>
So then, an std::array of std::arrays.
18:24
<&McMartin>
Yeah
18:24
<@celticminstrel>
Which might later be changed to an std::array of std::vectors.
18:25
<@celticminstrel>
(There's no reason for the outer array to be dynamically sized since it's indexed by a "treasure type index".)
18:26
<@celticminstrel>
I've been slowly replacing the C-style arrays with C++ stuff.
20:02
<@Tarinaky>
What's the reasoning behind this now?
20:03
<@celticminstrel>
Behind which?
20:04
<@Tarinaky>
It being better to use the STL all the way down
20:04
<@celticminstrel>
Oh.
20:04
<@Tarinaky>
Rather than C-Arrays
20:04
<@Tarinaky>
Or should that be all the way up?
20:04 * celticminstrel does think C-arrays make more sense for constant static data, though.
20:06 Kindamoody|afk is now known as Kindamoody
20:06
<@Tarinaky>
I've been using the STL for objects and methods, and C-style constructs for the functional and imperative bits. Because I have no idea what I'm doing.
20:06
<@Tarinaky>
*objects and attributes
20:06
<@celticminstrel>
Using arrays as a function parameter is generally not a great idea.
20:07
<@celticminstrel>
Because it's not really an array anymore.
20:08
<@Tarinaky>
Ehh, I've not really been bitten in the bum by that.
20:08
<@Tarinaky>
I mean, as long as you're not making shallow copies all over the place.
20:09
<@celticminstrel>
Uh, what?
20:09
<@Tarinaky>
Why are using arrays/pointers as function parameters a bad idea?
20:10
<@celticminstrel>
It's more just that using an array as a function parameter is misleading, since it's actually just a pointer and doesn't know its size.
20:11
<@celticminstrel>
(If it's a reference to an array, though, it does remember3 its size.)
20:11
<@celticminstrel>
^-3
20:12
<@Tarinaky>
So what?
20:13
<@Tarinaky>
I don't see how that's misleading...
20:13
<@celticminstrel>
It's not an array. It's a pointer.
20:14
<@Tarinaky>
'So'?
20:14
<@celticminstrel>
So, declaring it as an array is misleading.
20:16
<@Tarinaky>
I'm... not really sure I follow that...
20:17
<@Tarinaky>
The array is passed by pointer (the fact that it /is/ a pointer is just an implementation detail from using a compiler 2 iterations above programming by banging flint against UFO-sized disk platters)
20:17
<@Tarinaky>
There is an array.
20:18
<@celticminstrel>
Eh.
20:22
<&ToxicFrog>
Tarinaky: the array decays into a pointer to the first element of the array and the size must be passed separately, unlike std::vector and std::array which have the size built in.
20:23
<@celticminstrel>
Native array types also have the size built in.
20:23
<@Tarinaky>
Well yes, but I don't see that as being a /problem/
20:24
<&ToxicFrog>
As for the more general "why use STL everywhere": because unless you're interoperating with C code, the STL types give you more features and more safety, and you get various things for free like iterators and fold.
20:24
<@celticminstrel>
What's fold, again?
20:24
<&ToxicFrog>
It also means you don't need to worry about mixing memory allocation types or things not been properly destroyed on exception or the like.
20:25
<@Tarinaky>
OOO, we have folds?
20:25
<&ToxicFrog>
celticminstrel: aka reduce, although I think C++ calls it std::accumulate
20:25
<@celticminstrel>
Ah, right.
20:25
<@celticminstrel>
Tarinaky: In <numeric>
20:25
<@Tarinaky>
I'll have to check that out at work on monday.
20:25
<@celticminstrel>
But, you can also use it on bare arrays.
20:26
<@celticminstrel>
Like all the STL algorithms.
20:26
<@Tarinaky>
I... don't think anyone uses C++ for anything that doesn't interoperate with C code.
20:26
<@celticminstrel>
WHY NOT?
20:26
<@celticminstrel>
Whoops, somehow my caps lock went on.
20:26
<@Tarinaky>
Because there are nicer programming languages.
20:27
<@Tarinaky>
We may not be able to agree on what those are, but we can agree that there are nicer programming languages than C++ :P
20:27
<&ToxicFrog>
Tarinaky: in my previous job I was working on a high-performance embedded OS written entirely in C++.
20:27
<&ToxicFrog>
In my current one large chunks of the serving stack are written entirely in C++ for performance reasons.
20:27
<@Tarinaky>
ToxicFrog: Presumably you had to interoperate with assembly though?
20:28
<@Tarinaky>
For the OS.
20:30
<@Tarinaky>
Unless I'm misremembering something, the asm keyword is part of the C subset :P
20:36
<&ToxicFrog>
Don't be wilfully dense.
20:37
<&ToxicFrog>
If you're using a language other than C++, this entire conversation is irrelevant, because the question is "why prefer using the C++ STL exclusively to a mix of C++ and C types"
20:38
<&ToxicFrog>
If you are using C++, even in programs which interoperate with C libraries at some point -- which is not in fact "all C++ programs ever written" -- there's still going be lots of code that doesn't, and even in places where it does talk to C you can often still use an STL type and generate the C type as needed, e.g. std::string::c_str
20:51 gnolam [lenin@Nightstar-afpphi.tbcn.telia.com] has quit [[NS] Quit: Gone]
20:51 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving]
21:28 gnolam [lenin@Nightstar-afpphi.tbcn.telia.com] has joined #code
21:29 mode/#code [+o gnolam] by ChanServ
21:51 Kindamoody is now known as Kindamoody[zZz]
22:39 Checkmate [Z@Nightstar-ev6.6um.94.83.IP] has quit [Ping timeout: 121 seconds]
22:54 gnolam [lenin@Nightstar-afpphi.tbcn.telia.com] has quit [[NS] Quit: Gone]
23:06 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has joined #code
23:06 mode/#code [+qo Vornicus Vornicus] by ChanServ
23:14 Checkmate [Z@Nightstar-484uip.cust.comxnet.dk] has joined #code
23:14 mode/#code [+o Checkmate] by ChanServ
23:48 Thalasleep is now known as Thalass
--- Log closed Sun Dec 28 00:00:04 2014
code logs -> 2014 -> Sat, 27 Dec 2014< code.20141226.log - code.20141228.log >

[ Latest log file ]