|
Nuray wrote: I started with C++ because I hate C.
Fair enough. Who uses C now for Windows anyhow ?
Nuray wrote: I use C# because
I dislike C++.
Sounds like you will move to VB because you hate C#. What's wrong with C++ ?
Nuray wrote: MFC is difficult unnecessarily.
Rubbish.
Nuray wrote: the use of DLL is complicated you need to modify the code accordingly.
True. COM is easier overall than a standard dll, I think, but it's still messy and complex.
Nuray wrote: Just one more minor point; All C/C++ users are familiar with pointers
but C# user don't bother knowing it. I think new generation is more
lucky than us.
Well, it would help to know about pointers so you know what C# is doing. The new generation is unlucky, they will never learn the stuff that we just know through having to.
Nuray wrote: I didn't like the notation for keywords __gc or __value etc.
I don't like it either, but at some point you will need to choose a language, and use it.
Nuray wrote: There are similarities between MC++ and C#. It is not a big deal
switching from one to another but windows applications are very easy
in C# compared to MFC.
I've done a lot of both, I don't think either is that much easier than the other, if you know what you're doing.
Nuray wrote: MFC opens a lot of files that you need to know
very well in detail. C# opens two files one is code view and the
other is code view.
Wrong. MFC has three files, and that only because C++ has a header and a cpp file.
Nuray wrote: It hides the
generated code for the application.
Barely.
Nuray wrote: C# has great editor. The Outlining
feature is essential for the applications having many classes and
functions.
None of this fluff is 'essential', and I fear it becomes a way of not having to learn to organise your own code.
Nuray wrote: GUI applications is easy. I don't like doing things the hard way any
more.
Then do your entire app in C#, if you like it so much.
Nuray wrote: It is a platform for web based applications.
True, but your winforms app won't run on the web any more than your MFC app will. You need WinFX for that.
Nuray wrote: I want to run my C++
code on the web.
You can, via COM interop and ASP.NET or even just asp.
Nuray wrote: C# is my
favourite option but VS.NET 2003 is not good enough for my needs.
Because it's C# 1.1 ? Like I said, C# 2.0 generics are very much templates lite. There's a lot of C++ stuff in templates that generics do not support.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
(1) Who uses C?
Matlab users need to know C to understand some stuff. I use
fuzzy logic source code of it which is public and written in C
unfortunately. C survives like Fortran 77 and/or 90 due to some public
useful codes.
(2)What's wrong with C++ ?
I should admit that it works amazingly. I am very satisfied with it for
database programming(not ADO). It is a good tool for scientific
programming. But this doesn't mean that I never look for better one.
(3)Which language new generation should start with?
Let me repeat some points that you know very well for the sake of our
discussion. C++ is a low-level programming language like C. C# is high-
level programming language due to managed environment. That means you can
drive a car without knowing how it works. For example, no need to worry
about where to create the object in the memory(stack or heap?).NET
handles it. Perhaps C++ users might know both unmanaged and managed C++
in .Net environment. I think C# can attract more beginners. It is not as
powerful as C++ for the time being but eventually will catch up.
(4)Importance of editors
In Net C# and C++ don't have similar editor. Managed C++ have the similar
editor of Visual C++. Very disappointing. All good features are reserved
for C#. It has very intelligent editor. C++ users can't imagine what
they miss. You can notice your errors before compiling. It understands
when a class is created and helps to write its components with pup-op menu.
I think in later versions of C# the editor can create UML files of the
code. Not a bad idea.
(5) What am I going to do after all our discussion which is quite useful
for anybody not only for me?
I have decided to convert my old code in C++ to a web application using COM
and ASP. NET as you suggested. But I have to stop developing the code
using C++, it sounds as if I kill my baby, what a bad mother I am. I will
redevelop the code from scratch using C# so that I can add new classes
using a nice editor with the benefit of .NET features.
Of course, using C# will not solve all the dilemma of programmers but at
least Microsoft is good at advertising .NET technology to convince
dinosaurs like me to move from C++ to C#.
Yours
Nuray
|
|
|
|
|
Nuray wrote: (1) Who uses C?
I actually asked 'who uses C for windows programming'. I'm sure some people do, but not many.
Nuray wrote: But this doesn't mean that I never look for better one.
That's fair enough
Nuray wrote: I think C# can attract more beginners. It is not as powerful as C++ for the time being but eventually will catch up.
It will never catch up, in terms of raw power. We just won't care because our processors will get bigger and bigger. It's certainly catching up in terms of the language itself, I agree there.
I agree that the C# editor continues to have more features than the C++ editor.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/registry.asp
All about windows registry and how to use.
|
|
|
|
|
|
this is a simple question, i think there is probably a simple answer. im a newb with c
i looked on google but couldnt find out what my problem was.
i have this code
for(i=0; i < something; i++) {
sprintf(filename, "%i", i);
f = fopen(filename, "w");
}
how can i make it open files like
filename1
filename2
filename3
filename4
...etc?
thanks.
|
|
|
|
|
I hope this can do it:
sprintf(filename,"filename%i",i);
this is this.
|
|
|
|
|
Write a routine that does the following: for a given value N, create and initialize an N*N matrix. deduce the initialization algorithm from the following examples.
Example1: N=2
1 2
4 3
Example2:N=3
1 2 3
8 9 4
7 6 5
Example3: N=4
1 2 3 4
12 13 14 5
11 16 15 6
10 9 8 7
|
|
|
|
|
I doubt this is even remotely optimized, but here is a qad solution:
#define UP (UCHAR)0
#define DOWN (UCHAR)1
#define LEFT (UCHAR)2
#define RIGHT (UCHAR)3
UCHAR **Matrix( UCHAR n )
{
UCHAR **Result = new UCHAR *[n];
for ( UCHAR i = 0; i < n ; i++ )
{
Result[i] = new UCHAR[n];
memset( Result[i], 0, sizeof(UCHAR)*n );
}
UCHAR r, c;
UCHAR Dir;
UCHAR cc;
r = 0;
c = 0;
i = 1;
Dir = RIGHT;
while ( true )
{
cc = Result[c][r];
if ( cc != 0 )
{
if ( Dir == RIGHT )
{
if ( Result[c-1][r+1] == 0 )
{
Dir = DOWN;
c--;
r++;
}
else
{
break;
}
}
else
if ( Dir == DOWN )
{
if ( Result[c-1][r-1] == 0 )
{
Dir = LEFT;
c--;
r--;
}
else
{
break;
}
}
else
if ( Dir == LEFT )
{
if ( Result[c+1][r-1] == 0 )
{
Dir = UP;
r--;
c++;
}
else
{
break;
}
}
else
if ( Dir == UP )
{
if ( Result[c+1][r+1] == 0 )
{
Dir = RIGHT;
c++;
r++;
}
else
{
break;
}
}
}
Result[c][r] = i;
switch ( Dir )
{
case RIGHT:
if ( c == n - 1 )
{
r++;
Dir = DOWN;
}
else
{
c++;
}
break;
case DOWN:
if ( r == n - 1 )
{
c--;
Dir = LEFT;
}
else
{
r++;
}
break;
case LEFT:
if ( c == 0 )
{
r--;
Dir = UP;
}
else
{
c--;
}
break;
case UP:
if ( r == 0 )
{
c++;
Dir = RIGHT;
}
else
{
r--;
}
break;
}
i++;
}
for ( r = 0; r < n; r++ )
{
for ( c = 0; c < n; c++ )
{
printf( "%3u ", Result[c][r] );
}
printf( "\n" );
}
return Result;
}
int main(int argc, char* argv[])
{
Matrix( 5 );
return 0;
}
viola.
|
|
|
|
|
|
Hi I was reading Modern C++ Design by Andrei Alexandrescu. The author mentions an interesting technique in chapter 2 where you can use template specialization to select between the overloaded functions. To try it out I had written the following code
template <int v="">
struct Int2Type
{
enum { value = v };
};
enum { SimpleDispatch = 1, ComplexDispatch = 2 };
class Dispatcher
{
private:
int m_iDispatchType;
protected:
void DoDispatch(Int2Type<simpledispatch>)
{
AfxMessageBox("Simple Dispatch called");
}
void DoDispatch(Int2Type<complexdispatch>)
{
AfxMessageBox("Complex Dispatch called");
}
public:
Dispatcher() : m_iDispatchType(SimpleDispatch)
{}
Dispatcher(int iDispatchType):
m_iDispatchType(iDispatchType)
{}
void DoDispatch()
{
DoDispatch(Int2Type<m_idispatchtype>()); -------- [1]
switch(m_iDispatchType)
{
case SimpleDispatch:
DoDispatch(Int2Type<simpledispatch>());
break;
case ComplexDispatch:
DoDispatch(Int2Type<complexdispatch>());
break;
}
}
};
unfortunately unless I comment out line marked [1] the class does not compile, to make the class compile I had to use to switch alternative. So my question is why can't I write a above code. In the book the author has taken a bool variable example which is passed as a template variable.
I am missing something here? Doesn't the use of switch makes the code behave like the standard way, I mean If I have to use switch then I do not need template specialization here.
Any help is appriciated.
Thanks
|
|
|
|
|
|
Yep I am using VC++ 6.0.
Did microsoft fixed it in VC++ 7.0 or VC++ 7.1 ??
|
|
|
|
|
Hello!
I'm working on ARM embedded device. I have Flash device mapped into memory space trough which I controll it. I have the following problem:
I have to write some 32bit data to some address in memory. When I write to the location that is not modulo of number 4, I get exception;
example:
0x01000000 - ok
0x01000001 - exception
0x01000002 - exception
0x01000003 - exception
0x01000004 - ok
How to overcome this? Is it possible to write 32 bit data in atomic way and not first upper and then lower 2 bytes?
Rostfrei
-- modified at 3:30 Thursday 20th October, 2005
|
|
|
|
|
pragma pack 1 ? Haven't really thought this thru, but worth trying ~
|
|
|
|
|
Can software agent be written in VB.net to control consumption of computer energy such as monitors,i.e.putting monitor in sleep mode or stand by?
|
|
|
|
|
I create a server to listen the TCP command , such as HTTP command GET/POST etc.
However , I do not want to parse the command text.
How to know the client , such as IE, has completed transfering the command?
Thanks!
|
|
|
|
|
According to the HTTP spec, the request is finished with an empty line, so you have to wait for a double line feed.
POST is more complicated, your server has to use the return code "100 Continue" (unless the client is HTTP/1.0) and then you'll get the POST data, though many clients send it directly and don't wait for/require the 100-Continue.
|
|
|
|
|
Hello,
Can anybody help me in determining lan connectivity.
I want that whenever my lan cable is unplugged my program should be
get a notification.
With Rgds
VC++
|
|
|
|
|
WebConn error LNK2019: unresolved external symbol __imp__InternetOpenA@20 referenced in function _main
My program "WebConn" keeps getting this error when ever I use items in the wininet.h class.
I'm using Visual Studio .Net 2003, C++.
Any help would be great!
Brad
<br />
#define WINVER 0x0400<br />
#include "stdafx.h"<br />
#include <windows.h><br />
#include <wininet.h><br />
<br />
int main()<br />
{<br />
HINTERNET hInternetRoot;<br />
hInternetRoot = InternetOpen("My Agent", INTERNET_OPEN_TYPE_PROXY, "127.0.0.1", "<local>",0);<br />
<br />
return 0;<br />
}<br />
|
|
|
|
|
link Wininet.lib in project settings
|
|
|
|
|
Hi fellows
I have the jpeglib.h included in my code to do some works with images.
When I compile, the compiler show the following message:
[Link error] undefined reference to jpeg_destroy_decompress(jpeg_decompress_struct*)
There are a lot of messages like this, all of them are Link error problems.
The jpeglib.h lies in the include folder of my Dev C++ with the jerror.h, jconfig.h.
What's going on?
|
|
|
|
|
Hello,
I am making a virtual disk driver based on filedisk,
it is working very well under winxp but when i unmount the drive it doesn't disappear, instead it appears with a question mark
however it formats with all file systems under winxp.
on win 2000, it formats only under NTFS, not fat and fat32.
can u please help me with these 2 problems,
i mean the question mark under xp and the format problem under win2k
thanks in advance
Ahmed Abbas
|
|
|
|
|
Where can you create your virtual drive?
ps: This question supposted to be under "Operating Systems / SysAdmin" not in C++/CLI aka managed c++
|
|
|
|