C99 Question

  • Thread starter Vijay Kumar R Zanvar
  • Start date
S

Sidney Cadot

The said:
1. use a text edtor of your choice to write the sources that contains
the functions you likes to share with other languages
2. use a text editor of your choice to write one or more interface
file(s) (known as header files) to define the interfaces right use the
calling conventions your compiler supports to get the external entry
points described completely
3. use a C compiler of your choice to compile it error free with
highest warning level on,
tell the compiler to use the headers defined in step one to check
the definitions against the declarations
4. use a linker that is woth its name to build a library from the
object code your compiler generates
5. use the linker (or another program if they are separately on you
system) to build an interface module that generates an interface
module for the library that generates the needed object code to call
the library dynamically instead to bind it statically to a single
program. As this step is optionally, you will need it only to share
the same library with other programs at runtime.
6. use a text editor of your choice to write functions in another
programming language of your choice...... continue 2. - 5 to build
another libraries and object interfaces, replace C with C++, Fortran,
Pascal or any other langugae you knows of.

At least you gets many libraries written in many different languages
compiled with many different compilers together to many separately
compiled modules linked to single executeables whereas none of the
compilers knows of the others - but wors perfectly together.

But only step 3 has something to do with the topic of this newsgroup.
But this should show why Tisdale owns his nickname Twitsdale.

You forgot to answer the second andmore important of ERT's questions:

"Is your method guaranteed to work?"

(Hint: no. If you disagree, chapter and verse please)

Best regards,

Sidney
 
S

Sidney Cadot

The said:
There is none, not a single reason to recompile C code using something
that is NOT a C compiler.

That's quite an absolute statement. A bit too dogmatic for my taste.

Perhaps this would be better rephrased as "I cannot think of, and have
personally never encountered, such a reason."

If you disagree, please /prove/ the non-existence of such reasons.

Best regards,

Sidney
 
C

CBFalconer

P.J. Plauger said:
Oh, to have such certainty.

I still cherish a cartoon I clipped from Punch roughly half a
century ago. It shows two knights errant resting on horseback
beneath a tree. One says to the other, "Isn't life simple
when you know you're right all the time?"

It is unfortunate that Punch has bitten the dust, it was an
amazingly accurate publication.

I also maintain that one such possible reason is the one I gave
earlier, concerning "compilable by unwashed idiots on any compiler
without complaint or handholding". To clear something up, this
did not mean that users were necessarily such types, but simply
that allowance for such was to be made. Thus nobody was being
denigrated.
 
R

Richard Bos

P.J. Plauger said:
Believe what you want.

Of course we believe this; it is equivalent to what you yourself have
been giving as your reasons all along.

Do note, though, that said unwashed idiots do not include you yourself.

Richard
 
P

Programmer Dude

Sidney said:
Then we probably agree that Mr. Plauger at least has a valid
reason for wanting to compile C code using a C++ compiler.

Perhaps I can offer another.

I like--no, make that *love*--exceptions and the new operator.
I also *love* function and operator overloading. (Actually,
I just *like* operator overloading a lot. :) And there are
places where I like having a class or template.

But I also have a high regard for the simplicity and clarity
of straight C.

Using a hybrid of the two gives me the best of both worlds.
Needless to say, the compiler needs to be C++.
 
K

Keith Thompson

Programmer Dude said:
Perhaps I can offer another.

I like--no, make that *love*--exceptions and the new operator.
I also *love* function and operator overloading. (Actually,
I just *like* operator overloading a lot. :) And there are
places where I like having a class or template.

But I also have a high regard for the simplicity and clarity
of straight C.

Using a hybrid of the two gives me the best of both worlds.
Needless to say, the compiler needs to be C++.

Huh?

If you're using exceptions, the new operator, function and operator
overloading, classes, and templates, you're not compiling C code with
a C++ compiler. You're compiling C++ code with a C++ compiler.
 
R

Richard Bos

Keith Thompson said:
Huh?

If you're using exceptions, the new operator, function and operator
overloading, classes, and templates, you're not compiling C code with
a C++ compiler. You're compiling C++ code with a C++ compiler.

Moreover, if you're using new, you're not using malloc(), so you have no
need to cast malloc() calls, which is where this sub-thread started.

Richard
 
P

Programmer Dude

Keith said:

I said, "NEEDLESS TO SAY, THE COMPILER NEEDS TO BE C++!" (-:

If you're using exceptions, the new operator, function and operator
overloading, classes, and templates, you're not compiling C code
with a C++ compiler. You're compiling C++ code with a C++ compiler.

From a purest point of view, I suppose so. But it can be pretty
C-ish code sometimes.
 
K

Keith Thompson

Programmer Dude said:
Keith Thompson wrote: [...]
If you're using exceptions, the new operator, function and operator
overloading, classes, and templates, you're not compiling C code
with a C++ compiler. You're compiling C++ code with a C++ compiler.

From a purest point of view, I suppose so. But it can be pretty
C-ish code sometimes.

C++ contains most of C as a subset. You can write C++ that emphasizes
that subset, but from your description, I wouldn't describe your code
as a hybrid. At most, you're writing C++ with a mild C accent.
 
D

Default User

Keith Thompson wrote:
C++ contains most of C as a subset. You can write C++ that emphasizes
that subset, but from your description, I wouldn't describe your code
as a hybrid. At most, you're writing C++ with a mild C accent.


Better than with a Lisp.



Brian Rodenborn
 
P

Programmer Dude

Keith said:
C++ contains most of C as a subset. You can write C++ that
emphasizes that subset, but from your description, I wouldn't
describe your code as a hybrid. At most, you're writing C++
with a mild C accent.

Ah, I am orphaned. Disowned by the C community for writing
non-hybrid C++ code; disowned by the C++ community for not using
STL.

Woe. :-|




"...a mild C accent." I like that! (-:
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top