Hi everybody
Can you please explain me the weakpoints of c++ language?
I think it is very difficult to create GUI in C++, isn't it?
I also would like to know is there any method to combine C++ program and Java Program.
Hi everybody
Can you please explain me the weakpoints of c++ language?
I think it is very difficult to create GUI in C++, isn't it?
I also would like to know is there any method to combine C++ program and Java Program.
This note summarizes and expands the practical points in the thread (weakpoints of C++, GUI effort, and mixing C++ with Java) and ties them to specific options mentioned by other posters.
C++ is a high-control, high-performance language whose trade-offs are complexity and historical exposure to pointer- and resource-related bugs (as warned). Modern C++ idioms and rules-of-thumb—RAII, smart pointers, and language features introduced since C++11—substantially reduce those risks; follow the C++ Core Guidelines and prefer the modern standard library types where possible. was right that C++ is powerful but not always the fastest route for rapid application domains. ’s point about closures is addressed in modern C++ via lambdas (and later coroutines). (isocpp.github.io)
GUI work in C++ is mostly done with third-party frameworks rather than the language itself. Qt is a mature, cross-platform toolkit with an event system (signals/slots) and a visual designer that reduces boilerplate; wxWidgets and GTK are other popular choices, with platform-specific options (MFC/Win32) for Windows-only projects. Using a framework will usually be faster and less error-prone than hand-coding native widgets. (doc.qt.io)
On mixing Java and C++: ’s recollection is correct—Java can call native code via the Java Native Interface (JNI). JNI also defines an Invocation API so native apps can embed a JVM and call Java methods. Easier alternatives exist: JNA avoids writing JNI glue, and SWIG can generate language bindings; when coupling is loose, use IPC (sockets/REST/gRPC) to decouple runtimes. Watch common JNI pitfalls: mismatched signatures, wrong library paths/bitness, and thread attachment/exception handling. (docs.oracle.com)
Minimal JNI example:
// Java
public class NativeExample {
static { System.loadLibrary("native"); }
public native int add(int a, int b);
} // C++ (JNI)
#include <jni.h>
extern "C" JNIEXPORT jint JNICALL
Java_NativeExample_add(JNIEnv* env, jobject, jint a, jint b) {
return a + b;
} Recommendation: if GUI is the primary concern, pick a C++ GUI toolkit (Qt for cross-platform). If Java GUI is preferred, use JNA or process-level IPC to avoid JNI complexity.
Jump to Post— Ancient Dragon 5,243Hi everybody
Can you please explain me the weakpoints of c++ language?
there are none. The language will allow you to do anything you want to your computer -- even burn it up if you want it to.
I think it is very difficult to create GUI in C++, isn't …
Jump to Post— Bench 212C++ has features way beyond most other languages (eg multiple paradigm support in OOP and Parameterised programming), a huge community and wealth of high quality books available, and C++ really has no arbitary limitations in terms of what you can do with it. However, there's no such thing as perfect …
Hi everybody
Can you please explain me the weakpoints of c++ language?
there are none. The language will allow you to do anything you want to your computer -- even burn it up if you want it to.
I think it is very difficult to create GUI in C++, isn't it?
yes
I also would like to know is there any method to combine C++ program and Java Program.
java programs can call C functions, but I have not figured out how to call Java from C or C++. It may not even be possible, I don't know. I'm not a java programmer -- just repeating what I've read and heard co-workers say.
C++ has features way beyond most other languages (eg multiple paradigm support in OOP and Parameterised programming), a huge community and wealth of high quality books available, and C++ really has no arbitary limitations in terms of what you can do with it. However, there's no such thing as perfect - every language has its achilles heel IMO.
There are some things where C++ "falls down", to a point. or maybe can be done in other languages much more efficiently. For example, PHP beats most languages hands down for dynamic web content. C++ is also fairly intense compared to other languages (Python for example is regarded as a much friendlier language for beginners).
Also, I believe some of the subtle differences between C and C++ make C a better choice for certain applications involving embedded systems (that's just something i recall reading on comp.lang.c++, so don't quote me on that final point :) )
Another disadvantage of C++ is, it's quite easy to mess up memory due to pointer errors. Languges like Java do not use pointers, so Java does not have this problem.
However, with the new operating systems coming with better and better memory management, it is becoming increasingly difficult to make the kernal panic because the operating system can usually catch it before it can cause any damage.
If it is difficult to create GUI, is there any mentod to solve that problem?
I mean to write GUI in any other language and the rest of the program in C++.
> Can you please explain me the weakpoints of c++ language?
No call-with-current-continuation. No closures. I.e. C++ lacks fundamental features that other programming languages have (but most lack). It takes time and typing to do things that could be completed much more quickly and easily in other languages. No good macros (but templates are a pretty nice try). C++ is an abstract assembly language. (But that's also a strength, if that's what you need.)
But asking about weakpoints means nothing unless you mention a specific task. If you were to ask me what my weakpoints are, I'd say that I tend to be a bit lazy. I'm a student. But if I were a pro golfer, I'd probably talk about my short game. So, weakpoint at what? Every part of C++ is a weakpoint, if you're making some web application. If you're doing something with the Windows operating system, then PHP has major weakpoints. (If you're making a web application, then PHP still has major weakpoints :P.)
>>But asking about weakpoints means nothing unless you mention a specific task
And one person's idea of a weak point is another person's idea of a strength. The old adage "One man's trash is another man's treasure" comes to mind.
>>No call-with-current-continuation. No closures
Like to explain what that means?
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.