Hi,
Which section of C99 says that return value
of malloc(3) should not be casted?
Thanks.
--
Vijay Kumar R Zanvar
My Home Page - http://www.geocities.com/vijoeyz/
Nov 14 '05
110 4349
The Real OS/2 Guy wrote: On Thu, 1 Jan 2004 02:39:30 UTC, "E. Robert Tisdale" <E.**************@jpl.nasa.gov> wrote:
Richard Heathfield wrote:
I'm suggesting that, if you wish to use C code in a C++ program, you can generally do it without recompiling the C code.
Really! Are you an expert in C/C++ interoperability now?
Tell us how you would do it without compiling the C code with a C++ compiler. Is your method guaranteed to work?
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
The Real OS/2 Guy wrote: On Thu, 1 Jan 2004 20:56:35 UTC, Sidney Cadot <si****@jigsaw.nl> wrote:
Okay. Then we probably agree that Mr. Plauger at least has a valid reason for wanting to compile C code using a C++ compiler.
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
"P.J. Plauger" wrote: "The Real OS/2 Guy" <os****@pc-rosenau.de> wrote in message Sidney Cadot <si****@jigsaw.nl> wrote:
Okay. Then we probably agree that Mr. Plauger at least has a valid reason for wanting to compile C code using a C++ compiler. There is none, not a single reason to recompile C code using something that is NOT a C compiler.
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.
--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
"P.J. Plauger" <pj*@dinkumware.com> wrote: "CBFalconer" <cb********@yahoo.com> wrote in message news:3F***************@yahoo.com...
> Mr Zanvar should note that ERT, better known in these parts as > Trollsdale, is usually wrong and gives (as in this case) bad > advice.
Whatever his record, I happen to agree with him on this matter.
However you have, I believe, a different motive. You want your shrouded source to be compilable by unwashed idiots on any compiler without complaint or handholding.
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
Sidney Cadot wrote: 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++.
--
|_ CJSonnack <Ch***@Sonnack.com> _____________| How's my programming? |
|_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL |
|_____________________________________________|___ ____________________|
Programmer Dude <Ch***@Sonnack.com> writes: Sidney Cadot wrote:
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++.
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.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"
Keith Thompson <ks***@mib.org> wrote: Programmer Dude <Ch***@Sonnack.com> writes: Sidney Cadot wrote:
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.
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
Keith Thompson wrote: Using a hybrid of the two gives me the best of both worlds. Needless to say, the compiler needs to be C++. Huh?
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.
--
|_ CJSonnack <Ch***@Sonnack.com> _____________| How's my programming? |
|_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL |
|_____________________________________________|___ ____________________|
Programmer Dude <Ch***@Sonnack.com> writes: 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.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"
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
Keith Thompson wrote: 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.
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! (-:
--
|_ CJSonnack <Ch***@Sonnack.com> _____________| How's my programming? |
|_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL |
|_____________________________________________|___ ____________________| This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mohammed Mazid |
last post by:
Can anyone please help me on how to move to the next and previous
question?
Here is a snippet of my code:
Private Sub cmdNext_Click()
End Sub
Private Sub cmdPrevious_Click()
showrecord
|
by: Stevey |
last post by:
I have the following XML file...
<?xml version="1.0"?>
<animals>
<animal>
<name>Tiger</name>
<questions>
<question index="0">true</question>
<question index="1">true</question>
</questions>
|
by: nospam |
last post by:
Ok, 3rd or is it the 4th time I have asked this question on Partial Types,
so, since it seems to me that Partial Types is still in the design or
development stages at Microsoft, I am going to ask...
|
by: Ekqvist Marko |
last post by:
Hi,
I have one Access database table including questions and answers. Now
I need to give answer id automatically to questionID column. But I
don't know how it is best (fastest) to do?
table...
|
by: glenn |
last post by:
I am use to programming in php and the way session and post vars are past
from fields on one page through to the post page automatically where I can
get to their values easily to write to a...
|
by: Rider |
last post by:
Hi, simple(?) question about asp.net configuration..
I've installed ASP.NET 2.0 QuickStart Sample successfully. But, When I'm
first start application the follow message shown.
=========
Server...
|
by: Jeff |
last post by:
In the function below, can size ever be 0 (zero)?
char *clc_strdup(const char * CLC_RESTRICT s)
{
size_t size;
char *p;
clc_assert_not_null(clc_strdup, s);
size = strlen(s) + 1;
|
by: spibou |
last post by:
In the statement "a *= expression" is expression assumed to be
parenthesized ? For example if I write "a *= b+c" is this the same
as "a = a * (b+c)" or "a = a * b+c" ?
|
by: Allan Ebdrup |
last post by:
Hi,
I'm trying to render a Matrix question in my ASP.Net 2.0 page, A matrix
question is a question where you have several options that can all be rated
according to several possible ratings (from...
|
by: Zhang Weiwu |
last post by:
Hello!
I wrote this:
..required-question p:after {
content: "*";
}
Corresponding HTML:
<div class="required-question"><p>Question Text</p><input /></div>
<div...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |