Re: Avoiding C++ Templates In Cipher Implementation
From: Benjamin Goldberg (ben.goldberg_at_hotpop.com)
Date: 06/13/03
- Next message: Paul Rubin: "Re: AES in LibTomCrypt"
- Previous message: Mok-Kong Shen: "Re: (long) An AES implementation for 32-bit platforms"
- In reply to: Ernst Lippe: "Re: Avoiding C++ Templates In Cipher Implementation"
- Next in thread: Ernst Lippe: "Re: Avoiding C++ Templates In Cipher Implementation"
- Reply: Ernst Lippe: "Re: Avoiding C++ Templates In Cipher Implementation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Thu, 12 Jun 2003 21:14:42 -0400
Ernst Lippe wrote:
[snip]
> Many people see templates as a form of glorified macro's. Even though
> I am not a great fan of macro's I have to admit that their semantics
> are not really difficult. Macro's can be described as a simple textual
> operation on your source text that can then be used in the next phases
> of the compilation. Templates are completely different, unlike macro's
> it is not possible to write a simple program that removes the
> templates from your program and gives you back a semantically
> equivalent template-free program. In theory it may be possible to
> write such a program,
In theory, any cfront-style C++ compiler is such a program :)
Alas, in practice, many of them have *very* incomplete template
handling... last that I heard, anyway. My knowledge on this is quite
dated, though, and there may exist a more complete cfront compiler.
> but because templates are turing complete you
> cannot guarantee that this program will always terminate.
Isn't this true even with a regular C++ compiler?
Out of curiosity, what happens if you write a program which has:
template <int i> struct foo;
template <int i> { struct foo<i+1> bar; };
int main(int argc, char *argv[]) {
foo<0> quux;
return 0;
}
With a normal (non-cfront) C++ compiler, what happens?
--
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
- Next message: Paul Rubin: "Re: AES in LibTomCrypt"
- Previous message: Mok-Kong Shen: "Re: (long) An AES implementation for 32-bit platforms"
- In reply to: Ernst Lippe: "Re: Avoiding C++ Templates In Cipher Implementation"
- Next in thread: Ernst Lippe: "Re: Avoiding C++ Templates In Cipher Implementation"
- Reply: Ernst Lippe: "Re: Avoiding C++ Templates In Cipher Implementation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
|