| View previous topic :: View next topic |
| Author |
Message |
Tracey Guest
|
Posted: Tue Mar 20, 2007 7:51 pm Post subject: C verses C++ when using DeviceIoControl |
|
|
I am a-newbie planning on writing a console application that checks to see
if a tape is loaded in a dat drive.
While reading about:
CreateFile, DeviceIoControl, and SCSI in Microsoft's documentation, I see
a semi-frequent reference to "C".
When creating a new console applicaton, I am given the option of using C or
C++
(Would it matter / Is it better) to write this console application in C as
opposed to C++?
Or is it best to use C++ to build the console application?
Thanks, Tracey
BTW is C retained for backwards compatibility or does C actually fill a
specific need/requirement (even in "modern" applications)? |
|
| Back to top |
|
 |
Chris Uzdavinis (TeamB) Guest
|
Posted: Tue Mar 20, 2007 7:51 pm Post subject: Re: C verses C++ when using DeviceIoControl |
|
|
"Tracey" <wpiis (AT) gte (DOT) net> writes:
| Quote: | Thanks, Tracey
BTW is C retained for backwards compatibility or does C actually fill a
specific need/requirement (even in "modern" applications)?
|
It's probably safe to say that there are fewer "new" C applications
being written today, but I would bet that the number is still quite
high.
You can't judge a language's use based on the number of books at
Barnes and Noble shelves. (In many cases, publishers PAY to have
books included there.)
--
Chris (TeamB); |
|
| Back to top |
|
 |
Chris Uzdavinis (TeamB) Guest
|
Posted: Tue Mar 20, 2007 9:51 pm Post subject: Re: C verses C++ when using DeviceIoControl |
|
|
"Tracey" <wpiis (AT) gte (DOT) net> writes:
| Quote: | Why (under what conditions) would one write a C {console} application
instead of a C++ {console} application?
|
Some people just prefer C.
Not being one of those sharing that perspective, I probably wouldn't
put forth a good argument on their behalf. Therefore I won't try.
<g>
--
Chris (TeamB); |
|
| Back to top |
|
 |
Tracey Guest
|
Posted: Tue Mar 20, 2007 10:41 pm Post subject: Re: C verses C++ when using DeviceIoControl |
|
|
Why (under what conditions) would one write a C {console} application
instead of a C++ {console} application?
Thanks, Tracey
"Chris Uzdavinis (TeamB)" <chris (AT) uzdavinis (DOT) com> wrote in message
news:861wjkaufd.fsf (AT) explicit (DOT) atdesk.com...
| Quote: | "Tracey" <wpiis (AT) gte (DOT) net> writes:
Thanks, Tracey
BTW is C retained for backwards compatibility or does C actually fill a
specific need/requirement (even in "modern" applications)?
It's probably safe to say that there are fewer "new" C applications
being written today, but I would bet that the number is still quite
high.
You can't judge a language's use based on the number of books at
Barnes and Noble shelves. (In many cases, publishers PAY to have
books included there.)
--
Chris (TeamB); |
|
|
| Back to top |
|
 |
Craig Farrell Guest
|
Posted: Wed Mar 21, 2007 8:11 am Post subject: Re: C verses C++ when using DeviceIoControl |
|
|
Hi,
| Quote: | While reading about:
CreateFile, DeviceIoControl, and SCSI in Microsoft's documentation, I see
a semi-frequent reference to "C".
|
Going way back the Windows API was "C". Calling
conventions (how parameters were passed on the
stack) were pascal (older, 16 bit) and then stdcall
(newer, 32 bit) frequently. Because so many people
wanted to use C++ for Windows programming, e.g.
in frameworks, the headers and libraries have long
since been set up to handle calling Windows API's
from C++ code. This is done via extern "C" in the
headers for compile time. Libraries like import32.lib
are provided to handle linking.
--Craig |
|
| Back to top |
|
 |
Craig Farrell Guest
|
Posted: Wed Mar 21, 2007 8:11 am Post subject: Re: C verses C++ when using DeviceIoControl |
|
|
Hi,
| Quote: | Why (under what conditions) would one write a C {console} application
instead of a C++ {console} application?
|
One good reason would be legacy code, i.e. code
that you inherit that gets tons of errors in C++
because it is more strict.
--Craig |
|
| Back to top |
|
 |
Tracey Guest
|
Posted: Fri Mar 23, 2007 2:20 am Post subject: Re: C verses C++ when using DeviceIoControl |
|
|
Thank you for logical answer.
Tracey
"Craig Farrell" <cNO_SPAM.please.farrell (AT) insprise (DOT) com> wrote in message
news:460098e2$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Hi,
Why (under what conditions) would one write a C {console} application
instead of a C++ {console} application?
One good reason would be legacy code, i.e. code
that you inherit that gets tons of errors in C++
because it is more strict.
--Craig
|
|
|
| Back to top |
|
 |
Wayne A. King Guest
|
Posted: Wed Apr 04, 2007 8:11 am Post subject: Re: C verses C++ when using DeviceIoControl |
|
|
"Tracey" <wpiis (AT) gte (DOT) net> wrote in message
news:46000ebb$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Why (under what conditions) would one write a C {console} application
instead of a C++ {console} application?
|
If the compiled C program has a smaller "footprint" than the
equivalent compiled C++ program, one might prefer to use
C. This is most likely to be a consideration in embedded
systems development, where memory is scarce and not
easily expanded (if at all).
- Wayne
--
Wayne A. King
waking (AT) idirect (DOT) com |
|
| Back to top |
|
 |
|