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 4478
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++ interoperabilit y 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********@yah oo.com) (cb********@wor ldnet.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********@yah oo.com> wrote in message news:3F******** *******@yahoo.c om...
> 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_Keit h) 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.or g> 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_Keit h) 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 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 it differently.
FOUR QUESTIONS:
The background:
I got three (3) files
|
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 before
rowID answID qryrow questionID datafield
1591 12 06e 06e 06e question
1593 12 06f 06f 06f question
1594 12 answer to the question 06f
|
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 database or continue to process on
to the next page.
I am now trying to learn ASP to see if we can replace some of our
applications that were written in php with an ASP alternative. However,
after doing many searches on google and reading a couple...
| |
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 Error in '/QuickStartv20' Application.
--------------------------------------------------------------------------------
Configuration Error
Description: An error occurred during the processing of a configuration file
|
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 less to more for example).
I have a question object that has two properties that contain the
collections Options and Ratings.
now I want this kind of layout:
---
Rating1 Rating2 Rating3
Option 1 () () ...
|
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 class="not-required-question"><p>Question Text</p><input /></div>
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |