Talk:Generic swap: Difference between revisions

m
added a section header to the first topic to properly place the table-of-contents (TOC) --- (this happens more often than one would think).
(→‎C++: tested)
m (added a section header to the first topic to properly place the table-of-contents (TOC) --- (this happens more often than one would think).)
 
(8 intermediate revisions by 4 users not shown)
Line 1:
== task description too language-specific? ==
 
This task description seems to me a little too language-specific in its concepts.
 
Line 88 ⟶ 90:
</pre>
: So the copy went ahead, without calling any explicitly-define constructor. For reference, I'm using [[G++]] 4.1.3. In all, I think the implementation is fine. --[[User:Short Circuit|Short Circuit]] 19:06, 14 November 2007 (MST)
 
== boolga boolga boolga ==
 
y does the c version use char* and not void *? can it use anything? long* int* short* byte*etc?
:Because you can't operate on (void *), only refer to it. That said, a ''real'' implementation would cast to (int *) first (the most efficient machine word size), then finish any leftovers with a few less efficient (char *) swaps at the end. --[[User:IanOsgood|IanOsgood]] 18:50, 3 February 2008 (MST)
 
== dc ==
reverse is only available as a GNU extension (same with n, and comments (#) etc. - probably the other version should be kept too?)
[[User:Rahul|Rahul]] 20:46, 8 December 2008 (UTC)
: OK. Could you link (or simply list; dc is tiny) the standard dc commands on the language page? --[[User:IanOsgood|IanOsgood]] 02:02, 9 December 2008 (UTC)
:: I will add the list of commands to the dc page. [[User:Rahul|Rahul]] 09:13, 9 December 2008 (UTC)
 
AFIK, dc only has a single data type (numeric value), so how is it '''generic''' swap? --[[User:PauliKL|PauliKL]] 12:52, 9 December 2008 (UTC)
 
: Would be an interesting question, because since unityped systems are a subset of typed systems. So it can be argued that if dc is unityped, then all the procedures that it implements are generic by default. Interestingly dc is not unityped -
i.e
$dc
[ 1 2 3 4 ]
[ 5 6 7 8 ]
sa sb la lb
f
1 2 3 4
5 6 7 8
[[User:Rahul|Rahul]] 13:47, 9 December 2008 (UTC)