28 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
0
answers
75
views
Omitting function arguments for instantiating function templates
The short story is I am trying to have function templates and the main function in different compilation units like this (I am using g++ (GCC) 14.2.1 if it matters):
// a.cpp
template<typename T>...
0
votes
0
answers
61
views
Variable in C defined with 'inline' keyword [duplicate]
A variable defined with inline keyword in C++ allows definition of the variable in multiple compilation units and lets linker to resolve these multiple definitions into a single one, as it is ...
2
votes
2
answers
130
views
Java file naming restriction
Actually I was going through The Java Language Specification and I found a strange sentence from which I couldn't come to a conclusion. Since I'm not a native English speaker.
If and only if packages ...
0
votes
2
answers
123
views
Class definition in cpp but meet error: invalid use of incomplete type
I define the struct A in the a.cpp in the first.
// a.cpp
#include"a.h"
struct A { ...
2
votes
1
answer
108
views
Are non-compilation units in the unnamed package of a named module open?
I could not find any mention of this in the JLS, it only talks about how compilation units are placed in the unnamed module when they are in the unnamed package.
Background: Many libraries require ...
1
vote
1
answer
411
views
Use JDT to extract IcompilationUnits in a standalone Java application
I am writting an ordinary Java application and want to extract all ICompilationUnit of an input project (which is not necessary
developed by Eclipse). As I am not developing an Eclipse plugin, I can'...
1
vote
1
answer
934
views
Should a python file always include a class?
I have been coding in python for a couple months now, and something has always been on my mind. I know you can have classes in your .py file, but you don't have to. My question is, is it good practice ...
0
votes
2
answers
483
views
Using a global variable to initialize other global variable in different compilation units
I have a shared library which exports a function that returns a string from a global variable like so:
test.h:
const std::string &test_get_name();
test.cpp:
static std::string name = "Test";
...
0
votes
2
answers
124
views
How does the compiler and linker handle classes and functions
Can someone please help me to understand, why I can have the same class in two different compilation units without getting linker errors but not the same function in different compilation units?
Many ...
0
votes
1
answer
219
views
How to get problems in CompilationUnit regarding imports
I want to detect an error regarding an import statement. But compilation unit seems to detect errors inside the class declaration itself.
My code on which I am experimenting is as follows :
import ...
0
votes
1
answer
57
views
JavaCompiler didn't catch error on redefinition of a Java class.
During my Java learning, I tried this piece of code which compiled & ran successfully. Can anybody please provide an explanation that why hasn't the compiler generated any error? I imported the ...
1
vote
0
answers
309
views
Unable to parse code snippet in roslyn
I'm trying to dynamically build a c# class from small pieces of code. We have a window where a user can enter c# code (valid or not), and we parse these strings into roslyn. I recently found an issue ...
3
votes
1
answer
2k
views
JavaParser doesn't update source file
I'm using JavaParser and following its Wiki. Problem is even though I change the method's name and add a parameter to it, the file doesn't update. In other words, changes are not saved. When I System....
3
votes
1
answer
349
views
Eclipse create CompilationUnit handle from String
My question is similar to Eclipse create CompilationUnit from .java file however I don't have a file and I would like to create a handle for a CompilationUnit with given contents without actually ...
3
votes
1
answer
6k
views
Extracting AST from JAVA and printing the AST to a file
I'm a beginner to the Java programming language. I want to extract the AST from java source code and print the AST to a file or standard output.
I followed this tutorial to learn how to work with AST....