The tag has no wiki summary.

learn more… | top users | synonyms

2
votes
3answers
143 views

What is the difference between an array and a vector? [closed]

Uncoupling this question from any specific programming language, is there a difference between an Array and a Vector?
1
vote
0answers
65 views

What is the underlying mechanism behind va_list and where is it defined?

http://www.cplusplus.com/reference/cstdarg/va_list/ According to the above link, va_list is an argument or parameter used in some macros - va_start, va_arg, va_end. These macros are present in the ...
1
vote
1answer
84 views

If a variable containing a function gave the function's return instead of a reference to the function, what would an array of functions return? [closed]

I'm creating a prototype scripting language similar to something like Javascript. In my language, every single reference to a variable is actually a function call (a getter function), whether it has ...
0
votes
2answers
116 views

What are and how do (data-) types work?

What is a "variable"/data type? How does a compiler / interpreter handle types? My specific concern has to do with the different types in lower and higher level languages. For instance in Python, ...
21
votes
11answers
3k views

Why do we still use floats? [duplicate]

I understand why floats served a purpose in the past. And I think I can see why they're useful in some simulation examples today. But I think those example are more exceptional than common. So I ...
1
vote
3answers
335 views

Is it bad practice to check object types with an identifying member variable?

Preamble: I am making a simple board game in C++, in which AI characters move around squares on the board. There are different types of squares, each inherited from an abstract class, each with ...
0
votes
1answer
159 views

Generic name for types and values [closed]

In computer science, what is the abstract common name of types and values (I mean an abstract "something" that can be a type or a value) ? To be more specific: If we have template <typename X> ...
0
votes
2answers
182 views

Assert equality in mstest when types may differ

I've been working on some MSTest automated test infrastructure, that is testing a tool that merges data sets into SQL Server database tables. The basic structure of the test is to: Define the ...
2
votes
2answers
88 views

Should I put the datatype of a class attribute in its name?

Most of my system's class attributes are just text, but in this case it makes more sense to place this particular class's attributes into one single hash (from a "keep the source code pretty" aspect). ...
1
vote
1answer
169 views

Improving the efficiency of containers with dynamically allocated objects

This is not strictly related to C++ but its type system serves to illustrate the problem well. Assume: We have a generic template Container<T> (such as a std::vector<T>) which stores an ...
2
votes
1answer
133 views

Is every object rounded to the same size in Java?

According to this answer every object in Java is of the same size? Is the answer talking about the object itself or the reference to the object? Here's the statement: every object size is rounded ...
6
votes
3answers
1k views

Why do some of object oriented languages let programmer use primitive types?

Why do some object oriented languages let the programmer use primitive data types? Aren't classes like Integer, Boolean, etc. enough?
14
votes
5answers
1k views

Would it make sense to use objects (instead of primitive types) for everything in C++?

During a recent project I've been working on, I've had to use a lot of functions that kind of look like this: static bool getGPS(double plane_latitude, double plane_longitude, double plane_altitude, ...
0
votes
2answers
161 views

Boolean-Integer Typecasting to Replace Conditional

When choosing a value based off of 2 boolean values in this format var foo:int; if (X){ foo = 50; } else if (Y){ foo = -50; } else { foo = 0; } I discovered that I can condense this ...
3
votes
4answers
1k views

Why many programming languages have only 2 data-structures: arrays and hashes?

Many programming languages have only those 2 structures, and even some languages that have more structures still only provide special syntax for those 2; usually, [] and {}. Why is this? Is there ...
16
votes
4answers
2k views

Why does Java not do type inference?

I have always wondered why Java does not do type inference given that the language is what it is, and its VM is very mature. Google's Go is an example of a language with excellent type inference and ...
2
votes
1answer
2k views

Java default Integer value is int

My code looks like this import java.util.Scanner; public class StudentGrades { public static void main(String[] argv) { Scanner keyboard = new Scanner(System.in); byte q1 = ...
4
votes
3answers
232 views

I want to create an open data format… but I don't really know what that is

I have found a need for a standardization for storage and recording of data relating to diabetes information (I don't think there's any, but I may have missed it). To that end I made this github ...
8
votes
4answers
318 views

Origin of structures and classes

What design and implementation issues did programmers have to solve when they decided first to use structures and classes? When did this happened and who were the pioneers behind these ideas? Note, ...
24
votes
9answers
12k views

What is meant by a primitive data type?

My understanding of a primitive datatype is that It is a datatype provided by a language implicitly (Others are user defined classes) So different languages have different sets of datatypes ...
2
votes
3answers
222 views

Web Development: is always Typing necessary or can type on demand work?

I realize this idea might seem really foreign but I started thinking about this a bit back. Far as web sites go, at least in my experience, there is far more time spent retyping things to a String ...
4
votes
5answers
817 views

Why disallow int-to-short assignment but allow multiplication and other math?

In Java, the following code does not compile: int val = 1; short shortVal = val; // Incompatible types Anyone know why Java chooses to complain about this assignment, instead of simply truncating, ...
9
votes
5answers
277 views

Examples of limitations in IT due to different bit length by design

I am teaching the course "Introduction in Programming" for the first-year students and would like to find interesting examples where the datatype size in bits, chosen by design, led to certain known ...
5
votes
3answers
236 views

Eliminating Dependencies vs Eliminating Redundancy

Upon my assignment to a project, I discovered that many message classes were received and then kept intact and passed around inside the receiving application. When these messages changed, code ...
11
votes
3answers
3k views

Why were short, int, and long invented in C?

I'm having trouble understanding, what were the exact purposes of creating the short, int, and long data types in C? The reason I ask is, it doesn't seem like their sizes are bounded -- they could be ...
1
vote
2answers
129 views

Does hierarchial inheritance belong to the past? [closed]

Recently it came to my attention that hierarchical inheritance may be a relic of thinking of classes as "structs with functions" rather than a product contract-driven mentality. Consider, as a simple ...
8
votes
3answers
586 views

Is integer used too much as a data type?

Do most application developers use signed integers in places where they really mean to use unsigned integers? I do it all the time, so do my co-workers. I haven't seen a lot of other extensive ...
3
votes
1answer
223 views

What are the advantages of having a built-in datatype in a data interchange format over not having it?

Due to the requirement of a project we had to develop a data interchange format with a built in data types. The format served the purpose well in the scope of that project. But I was thinking that ...
5
votes
2answers
685 views

What Are The Uses of Algebraic Data Types?

I'm reading about Algebraic Data Types (thanks to Richard Minerich I found this excellent explanation of the concept). While I think I understand the notion of sum types and product types etc., what ...
32
votes
22answers
9k views

Is type safety worth the trade-offs?

I began coding in in Python primarily where there is no type safety, then moved to C# and Java where there is. I found that I could work a bit more quickly and with less headaches in Python, but then ...
17
votes
6answers
7k views

C#: Explicitly defining variable data types vs. using the keyword 'var'?

In C#, am I encouraged to use the all-purpose var keyword for every variable declaration? If yes, do I have to mention those special characters for literal values within the variable declaration like ...
17
votes
24answers
1k views

Interesting or unique types in programming languages? [closed]

We have all seen integer, floating point, string, and the occasional decimal type. What are some of the most strange or unique or useful types you have encountered, useful or not?
8
votes
5answers
1k views

Understanding Abstract Data Types (ADTs)

Just browsing through Code Complete last night and I came across the explanation of abstract data types. I must have read it 5 times, and the Wikipedia article doesn't help much either. So what I'm ...
12
votes
16answers
2k views

What's the idea behind defining rectangles with two points?

It's not that this doesn't make sense, but it just works out awkward 99% of the time. Often in 2D graphics rectangles are initialized, stored and manipulated as a pair of points. In no particular ...
2
votes
2answers
341 views

Data structures for bioinformatics

what are some data structures that should be known by somebody involved in bioinformatics? I guess that anyone is supposed to know about lists, haseshes, balanced trees etc, but I expect that there ...