standard headers

B

BilfFord X

If I
# include "text.h"
, where text.h consists of the following:
# define NOTHING_IMPORTANT
# include <stdio.h>
, am I writing c++? cordially, bfx
 
V

Victor Bazarov

BilfFord said:
If I
# include "text.h"
, where text.h consists of the following:
# define NOTHING_IMPORTANT
# include <stdio.h>
, am I writing c++? cordially, bfx

Yes, you are... I am feverishly looking for a catch in
your question. I don't see it, though. Why did you ask?

Generally speaking, including <stdio.h> is OK, but in C++
we usually include <cstdio> instead.

V
 
B

BilfFord X

Victor Bazarov said:
Yes, you are... I am feverishly looking for a catch in
your question. I don't see it, though. Why did you ask?

Generally speaking, including <stdio.h> is OK, but in C++
we usually include <cstdio> instead.
I'm trying to get a handle on what makes a non standard header non standard.
I've been cutting open the header files for my implementation, and they
haven't oozed evil like one would expect. The following is a header file
from jacob navia's lcc:
#ifndef __windows_h__
#define __windows_h__
#ifndef __stdlib_h__
#include <stdlib.h>
#endif
#ifndef __string_h__
#include <string.h>
#endif
#include <win.h>
#endif
/* end header post */
This poor fella gets slapped around on the other end of the hallway because
of non standard headers more than Mike Tyson's girlfriends. In these ten
statements, where lies the offense, in particular, when you and I have no
notion what could be in win.h? cordially, bfx
 
I

Ian Collins

BilfFord said:
I'm trying to get a handle on what makes a non standard header non standard.

Simple - if you can't find it in the standard, it ain't a standard header.

Thus if you us it, your code isn't portable to other systems.
 
B

BilfFord X

Ian Collins said:
Simple - if you can't find it in the standard, it ain't a standard header.

Thus if you us it, your code isn't portable to other systems.
Is my text.h above in the standard? cordially, b
 
B

BilfFord X

Ian Collins said:
Of course not, but everything it includes is. Try and apply some common
sense.
All right. So you're not going to be able to include a file that ultimately
includes an implemention-specific file such as windows.h , and drag it in
wholesale.

Is this:
#ifndef _WINDOWS_
#define _WINDOWS_
where windows.h craps out as standard? cordially, b
 
V

Victor Bazarov

BilfFord said:
I'm trying to get a handle on what makes a non standard header non
standard.

Your 'text.h' is a non-standard header. It doesn't matter that all
in it is standard C++. If it's not defined by the Standard, it's
not standard. However, when you asked "am I writing c++", the answer
is still "yes". Whatever we write is what we write, and our headers
while non-standard can still be a perfectly fine C++.
I've been cutting open the header files for my
implementation, and they haven't oozed evil like one would expect. The
following is a header file from jacob navia's lcc:

I honestly have no idea what "jacob navia's lcc" is.
#ifndef __windows_h__
#define __windows_h__
#ifndef __stdlib_h__
#include <stdlib.h>
#endif
#ifndef __string_h__
#include <string.h>
#endif
#include <win.h>
#endif
/* end header post */
This poor fella gets slapped around on the other end of the hallway
because of non standard headers more than Mike Tyson's girlfriends.

I don't understand. Why would he get slapped? Does he claim any
standard compliance? Does he claim to provide a C++ implementation?
In these ten statements, where lies the offense, in particular, when
you and I have no notion what could be in win.h? cordially, bfx

Why do you care what's inside *his* headers? If you need to include
them, include them. If you don't, don't. Furthermore, why do you
care what's in the headers that his headers include? Why should you
be aware of what <win.h> is? What if it's some obscure part of what
he provides to you?

V
 
I

Ian Collins

BilfFord said:
All right. So you're not going to be able to include a file that ultimately
includes an implemention-specific file such as windows.h , and drag it in
wholesale.

Is this:
#ifndef _WINDOWS_
#define _WINDOWS_
where windows.h craps out as standard? cordially, b
You are either a troll or a Muppet.

windows.h is a non-standard header because it isn't a standard header.
 
B

BilfFord X

Victor Bazarov said:
Your 'text.h' is a non-standard header. It doesn't matter that all
in it is standard C++. If it's not defined by the Standard, it's
not standard. However, when you asked "am I writing c++", the answer
is still "yes". Whatever we write is what we write, and our headers
while non-standard can still be a perfectly fine C++.
That's the answer I was looking for. Thank you.
I honestly have no idea what "jacob navia's lcc" is.


I don't understand. Why would he get slapped? Does he claim any
standard compliance? Does he claim to provide a C++ implementation?
I don't understand either. He's on the receiving end of a lot of abuse over
this. Whether it's deserved is not something I can judge.
Why do you care what's inside *his* headers? If you need to include
them, include them. If you don't, don't. Furthermore, why do you
care what's in the headers that his headers include? Why should you
be aware of what <win.h> is? What if it's some obscure part of what
he provides to you?
It seems odd to me that the solution to the problem of non-standard headers
would seem to be to paste them into the implementation. Happy Fourth. bfx
 
O

Old Wolf

BilfFord said:
Is this:
#ifndef _WINDOWS_
#define _WINDOWS_
where windows.h craps out as standard? cordially, b

_WINDOWS_ is in the implementation namespace, so if you
define it yourself then you might break a standard header.

Your defines should not start with _ followed by a capital letter,
nor contain a double underscore anywhere.
 
B

BilfFord X

[begging the question and something about Muppets snipped]
I was apprised yesterday of Dr. Feit's passing. To be a character
associated with Frank Oz is fine with me. I am not the fastest of
creatures, that is, if REAL_LIFE is OT. Those who know the representation
half of Feit-Thompson know his influence on today's programmer. bfx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top