void

Java no response from other classes

人走茶凉 提交于 2019-12-08 11:50:22
问题 I have this GUI program where I'm trying to basically copy windows CMD. Since I have lots of features in this program, I decided to put parts of the code in different classes. But it doesn't respond. if(command.size()<2 && command.size()>0) { switch(command.get(0)) { case "dt": getDateTime a = new getDateTime(); a.Start(); break; // other case(s) down below } } Here is the geDateTime class public class getDateTime { public static void Start() { Terminal t = new Terminal(); try { DateFormat

C++ how to get the address stored in a void pointer?

☆樱花仙子☆ 提交于 2019-12-08 09:08:31
how can i get the memory address of the value a pointer points to? in my case it is a void pointer. just assigning it to an uint gives me this error: Error 1 error C2440: 'return' : cannot convert from 'void *' to 'UInt32' thanks! std::size_t address = reinterpret_cast<std::size_t>(voidptr); // sizeof(size_t) must be greater or equal to sizeof(void*) // for the above line to work correctly. @Paul Hsieh I think it is sufficient to convert void* to size_t in this specific question for three reasons: The questioner didn't specify if he wants a portable solution or not. He said, that it worked

C++ how to get the address stored in a void pointer?

我们两清 提交于 2019-12-08 08:49:25
问题 how can i get the memory address of the value a pointer points to? in my case it is a void pointer. just assigning it to an uint gives me this error: Error 1 error C2440: 'return' : cannot convert from 'void *' to 'UInt32' thanks! 回答1: std::size_t address = reinterpret_cast<std::size_t>(voidptr); // sizeof(size_t) must be greater or equal to sizeof(void*) // for the above line to work correctly. @Paul Hsieh I think it is sufficient to convert void* to size_t in this specific question for

pointer to void

醉酒当歌 提交于 2019-12-08 04:01:57
问题 This is kind of basic but I can't seem to get a hold on this one. Reference here Are void *p and const void *p sufficiently different? Why would a function use const void * instead of void * ? 回答1: The reason to use void* at all (whether const or not) is the kind of genericity it provides. It's like a base class: All pointers are void* and can implicitly cast into it, but casts from void* to typed pointers have to be done explicitly and manually. Usually, C++ has better ways to offer to do

Passing a vector to a function as void pointer

Deadly 提交于 2019-12-08 02:47:08
问题 I have a callback function that takes a void * as a parameter to pass arguments to and I'd like to pass a vector to the function. The function will be called multiple times so after the callback process is complete, I'd like to be able to iterate over all the elements that have been push_back() 'ed through the callback. static void cb(void *data) { vector<int> *p = static_cast<vector<int>*>(data); //Attempting to convert *void to vector<int> p->push_back(1); } int main() { vector<int> a(10);

How to return data from void function?

泪湿孤枕 提交于 2019-12-07 23:24:08
问题 So, around a week ago I asked a question about activex and UDP. Here it is: C# UDP Socket client and server Now, I created two applications, one (the sender) to send pre-defined strings via UDP. The other is activex component that is called from a webpage, and it's thread is working in the background. Once an UDP message arrives, then it's doing it's stuff (writing in database, writing in log.txt, and so on). The last thing i need is to return data (it's yet to be said if it will be string or

Use instanceof Void in java

这一生的挚爱 提交于 2019-12-07 21:03:28
问题 I want to use the type of void java but I can't. Here is a my code which is an aspect run after to all methods which have @TraceLog annotations @AfterReturning(value = "@annotation(log)", returning = "returnValue", argNames = "joinPoint, log, returnValue" ) public void afterReturning(final JoinPoint joinPoint, final TraceLog log, final Object returnValue) { Class<?> returnType = ((MethodSignature) joinPoint.getSignature()) .getReturnType(); //It works when comperaing with string. But I want

drawbacks of a void pointer in C++ [closed]

被刻印的时光 ゝ 提交于 2019-12-07 15:20:42
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . A far as I know, a void pointer in C++ void* can point to anything. This might be quite useful (for me) if I want to develop a

When to use a void pointer over a char pointer?

早过忘川 提交于 2019-12-07 10:03:34
问题 In which situation should we prefer a void pointer over a char pointer or vice-versa? As a matter of fact both can be type cast to any of the data types. 回答1: A void pointer is a pointer to "any type", and it needs to be converted to a pointer to an actual type before it may be dereferenced. A pointer to char is a pointer to char , that happens to have the property that you could also access (parts of) other types through it. You should use void * when the meaning is intended to be "any type"

c incompatible types in assignment, problem with pointers?

雨燕双飞 提交于 2019-12-07 04:01:53
问题 Hi I'm working with C and I have a question about assigning pointers. struct foo { int _bar; char * _car[SOME_NUMBER]; // this is meant to be an array of char * so that it can hold pointers to names of cars } int foofunc (void * arg) { int bar; char * car[SOME_NUMBER]; struct foo * thing = (struct foo *) arg; bar = thing->_bar; // this works fine car = thing->_car; // this gives compiler errors of incompatible types in assignment } car and _car have same declaration so why am I getting an