Re: Nasty code...but please critique it anyway :-)
From: Martijn Lievaart (m_at_rtij.nl.removefromhere.invalid)
Date: 11/07/03
- Next message: Martijn Lievaart: "Re: Nasty code...but please critique it anyway :-)"
- Previous message: André Pönitz: "Re: Objects"
- In reply to: J. Campbell: "Re: Nasty code...but please critique it anyway :-)"
- Next in thread: Martijn Lievaart: "Re: Nasty code...but please critique it anyway :-)"
- Reply: Martijn Lievaart: "Re: Nasty code...but please critique it anyway :-)"
- Reply: J. Campbell: "Re: Nasty code...but please critique it anyway :-)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 07 Nov 2003 10:30:26 +0100
On Thu, 06 Nov 2003 12:51:57 -0800, J. Campbell wrote:
> Jerry Coffin <jcoffin@taeus.com> wrote in message news:<MPG.1a140b966bc2ca26989bd6@news.clspco.adelphia.net>...
>> In article <b97c86e1.0311041217.2aeb32b7@posting.google.com>,
>> mango_maniac@yahoo.com says...
>>
>> [ ... ]
>>
>> > I must be pretty dense...I had the hardest time understanding what I
>> > was doing wrong. I think I get it now. Will you take a look at the
>> > (revised) code from my first link in this thread and tell me if my use
>> > of headers is now more or less normal?
>>
>> If I still had the link handy I would, but I don't...
>
> http://home.bellsouth.net/p/PWP-brightwave
>
> Sorry I didn't include the link before...I didn't want people to think
> that I was entheusiastically pimping my novice code, and the link was
> just up the thread, at least on my newsreader ;-) Anyway, thanks for
> responding.
g++ -c -o J_Crypt.o J_Crypt.cpp
In file included from J_Crypt.h:9,
from J_Crypt.cpp:1:
hashSclass.h:6:30: alignint_class.h: No such file or directory
In file included from J_Crypt.cpp:1:
J_Crypt.h:10:30: filespec_class.h: No such file or directory
J_Crypt.h:15:23: encrypt.h: No such file or directory
In file included from J_Crypt.h:16,
from J_Crypt.cpp:1:
unencrypt.h:9:26: HashSclass.h: No such file or directory
unencrypt.h:13:30: filespec_class.h: No such file or directory
In file included from J_Crypt.h:16,
from J_Crypt.cpp:1:
unencrypt.h:15: `Filespec' was not declared in this scope
(snip a lot more errors due to missing headers)
make: *** [J_Crypt.o] Error 1
Compilation exited abnormally with code 2 at Fri Nov 7 10:18:11
It really is better to watch your case. :-)
A quick look on some random chosen files.
- hashSclass.h
You only need <string>, move all the other #includes to the C++ files.
- J_Crypt.h
A file that includes all other headers. A style issue, but I don't like
it. Also, including <iostream> may lead to code bloat and longer
compilation times. Include it only where needed.
- Encrypt.cpp
Looks good. Good comments, very readable. Only thing is that you do user
interaction here. Better to decouple this. A way to do that would be to
pass a const ostream& or a function pointer to a function that can write
strings. The latter technique makes sure you can use the same encrypt
routine in a GUI program as well.
- menu.cpp
* Get text by line and parse that, good!
* You may want to use a std::stringstream to parse the integer, else just
use atoi.
* Why not print the menutext the first time from menu1 as well?
Inconsistent.
* You may want to flush the output stream after printing menutext, in
trhis function you cannot be sure it is terminated with a newline.
HTH
M4
- Next message: Martijn Lievaart: "Re: Nasty code...but please critique it anyway :-)"
- Previous message: André Pönitz: "Re: Objects"
- In reply to: J. Campbell: "Re: Nasty code...but please critique it anyway :-)"
- Next in thread: Martijn Lievaart: "Re: Nasty code...but please critique it anyway :-)"
- Reply: Martijn Lievaart: "Re: Nasty code...but please critique it anyway :-)"
- Reply: J. Campbell: "Re: Nasty code...but please critique it anyway :-)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|