Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!helios!bcm!dimacs.rutgers.edu!seismo!uunet!decwrl!pa.dec.com!decuac!haven!uvaarpa!mmdf From: marc@athena.mit.edu (Marc Horowitz) Newsgroups: comp.lang.perl Subject: Re: why is this in h2ph Message-ID: <1991Jan31.215353.23619@uvaarpa.Virginia.EDU> Date: 31 Jan 91 21:53:53 GMT Sender: mmdf@uvaarpa.Virginia.EDU (Uvaarpa Mail System) Reply-To: marc@mit.edu Organization: The Internet Lines: 54 I said: |> : #define lettera ((char) 65) |> : |> : becomes |> : |> : sub lettera {(('char') 65);} Larry responds |> The lettera definition is unlikely to do you much good in Perl, so the |> correct way for h2ph to protect it would be to enclose it in an eval. well, what I'd like to see output is sub lettera { 65; } That would let me use &lettera in the same way the #define was intended to be used. |> How about predefining %sizeof for us Larry! A reasonable approximation |> might be, `if you have to mess with it in perl's C code, it then |> a user might want to know about it as well'. Yes. And while you're at it, instead of kludging sizeof, special case it: s/^sizeof\(([^\)])\)/$sizeof{'$1'}/; Or something like that. That way, it would be obvious what was going on, and if I had sizeof(struct foobar) in my .h file, I could add $sizeof{'struct foobar'} = 42; somewhere before (or in) the .ph file and make it do what I want. I guess this is something else to add to my todo list. Root Boy Jim says: |> I read a style guide from one of the Bell guys (Pike?). One of |> his prohibitions was include files including other include files. |> The inclusion control is done at the wrong place; inside the file rather |> than around the #include. It is not uncommon for things like |> to be included ten (and ignored nine) times in a single compilation. This is completely off subject, but I need to ask. Do you agree with this restriction? I believe inclusion control should be transparent to the includer. So the right place to do it is in cpp, but since ANSI blew it, I think enclosing the entire include file in #ifndef/#endif is the right solution. My justification is that if I #include , I shouldn't need to track down the 17 other files it includes recursively. And I'd rather not think about making it do the right thing under all the different flavors of Unix I'd like my code to compile under. If you agree with me that Pike is completely off his rocker on this one, then ignore the previous paragraph :-) Marc