Most voted "typing" questions
For data type system related issues.
Learn more…349 questions
Sort by count of
-
111
votes7
answers13788
viewsHow to represent money in Javascript?
What is the best way to represent monetary units (i.e. money) in Javascript? I know it is not good to use floating point, given the rounding problem, but I do not know what would be the best…
-
101
votes3
answers33467
viewsWhat is the difference between a static and dynamic programming language?
Some time ago, Facebook launched its own programming language, based on PHP. See: Tecnoblog: Facebook announces Hack, its own programming language. Tecnoblog explains in the following way the…
-
82
votes7
answers21276
viewsBest kind of data to work with money?
I am developing a project for commercial automation, using PAF-ECF and everything else. Would Aual be the best type of data to work with SQL Server and C# for money issues? Mainly in relation to…
-
65
votes6
answers66144
viewsType of the CPF or CNPJ field in the VARCHAR or INT database?
What type of CPF or CNPJ field in the database VARCHAR or INT? I’ve seen some posts suggesting using INT to optimize performance in the event of JOINand filters. If you have 0 the left is only…
-
57
votes5
answers7848
viewsWhat is the difference of string vs string?
I wonder what the real difference is between String (capital letters) and string (s tiny). Apparently the two have the same goals, but which is "best" to use?
-
56
votes4
answers3125
viewsPrecise math division
In Windows calculator: 9/3,0001 = 2,999... In my program: 9/3,0001 = 3; I would like to get that level of accuracy using C. Watch excerpts from my program: double op(double num1, double num2, char…
-
55
votes4
answers1510
viewsWhy in PHP does the expression "2 + '6 apples'" equal 8?
I found the example funny, but the question is valid in the sense of understanding why PHP behaves this way. When we do the following example sum (an integer added to a string): $numero_macas = 2 +…
-
51
votes2
answers4996
viewsMemory allocation in C# - Value types and reference types
In C# there is a difference between the form that memory is allocated by the CLR for reference types (classes) and value types (structures). The difference, from what I’ve always heard, would be…
-
49
votes2
answers1582
viewsHow can -1 be greater than 4?
How this code can execute in this way? #include <stdio.h> int main(void) { printf("tamanho de um inteiro: %d\n", sizeof(int)); if(sizeof(int) > -1) { printf("4 é maior que -1"); } else {…
-
48
votes6
answers7903
viewsWhen should we allow a column of a table from a database to accept NULL?
This is a conceptual question that always creates confusion when deciding whether or not a column should accept NULL. There’s a current that considers the use of NULL to be an error and that an…
-
45
votes6
answers2425
viewsArrays are pointers, right?
After all, in C, an array a[] becomes a pointer *a? If not, what are arrays? What are the differences between them? How arrays work internally?
-
42
votes3
answers5198
viewsDifference between the use of typeof and is
In C# when I need to check if a variable is of a certain type, I usually use the operator is: if(qualquerVariavel is int) Console.Write("A variável é int"); I know it is also possible to check the…
-
38
votes2
answers2688
viewsWhy do you usually declare a variable with default value?
In several applications that have been written with strongly typed languages, a variable (usually) is declared with its default value. Example: int x = 0; double y = 0; However, it is possible to…
c# variables characteristic-language typing variable-declarationasked 7 years, 5 months ago UzumakiArtanis 9,534 -
33
votes4
answers41801
views -
31
votes3
answers1336
viewsIs it ideal to use primitive types in Java?
Java has several wrapper’s who help us (Integer, Double, BigDecimal), and also gives us the possibility to use primitive types (int, float, char). A teacher told my college class that Java should…
-
29
votes3
answers660
viewsShould we validate function parameters?
In languages like Java, method parameters are "validated" in the build (at least the type): public void facaAlgo(String str) { // ... } // em algum outro lugar: int i = 2; this.facaAlgo(i); // erro…
-
29
votes2
answers11436
viewsWhat is the difference between Boolean and Boolean?
I performed some tests using Boolean and boolean and apparently returned the same result. See below: Boolean bool = true; boolean bool2 = true; if(bool) Log.wtf(TAG, "Funciona!"); if(bool2)…
-
23
votes5
answers573
viewsWhy are you wearing shorts?
The guy short corresponds to a 16-bit integer - it is literally syntactic sugar for type Int16. The current processors are all 64 bits, even on the most machines low-end. Some older machines still…
-
22
votes2
answers19395
viewsWhat’s the difference between varchar and nvarchar?
What’s the difference between using data types varchar and nvarchar? nvarchar exists in every SQL database? Is there any significant difference in performance between the two? There is a criterion…
database sql-server string typing character-encodingasked 7 years, 5 months ago UzumakiArtanis 9,534 -
21
votes3
answers23896
viewsDifference between type text and type varchar in SQL Server
What’s the difference of using text instead of type varchar to store information in the database? Is there a performance problem? Because I have a table in the database that has a column text and…
-
21
votes2
answers11055
viewsWhat is the advantage of using the ENUM type?
When I should use the guy ENUM because even today where I saw this guy being used he could be replaced by VARCHAR or even for a simple CHAR, I can’t see a case where in it it really becomes…
-
20
votes7
answers43303
viewsHow do I know if a variable is of the Javascript Number type?
In javascript, because there is no declaration of the types of variables such as Integer, String, Boolean, etc., it is a difficult task to know what kind of value you are dealing with in a given…
-
20
votes2
answers25606
viewsWhat kind of data (double, float or decimal) should I use to represent currency in . NET with C#?
Although I am aware of what would be better to use, I ask this question for educational purposes since I see several examples of people using double in C#. But I’ve had problems with double for coin…
-
19
votes3
answers6965
viewsTyped and untyped programming languages
Why (I don’t know if it’s a rule) are interpreted programming languages (e.g., PHP) not typed and compiled (e.g., C) typed? (Java in this case is a hybrid). Why do they have these differences?…
-
18
votes3
answers18194
viewsWhat purpose of unsigned in C++
What is the purpose of unsigned in the C++? Example: unsigned char ch2;
-
17
votes2
answers1806
viewsWhy does a calculation with positive numbers give a negative result?
Why does this one count (100 * 22118400) / 44954676 in Java gives a negative number? -46 /* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import…
-
16
votes4
answers4778
viewsHow do value types and reference types work in Javascript?
I know that in C# there are value types and reference types and one of the differences between them is in memory management. What decides how the variables will behave is their type, so if it’s a…
-
16
votes3
answers1076
viewsIs it correct to prefix variable names with their type?
It is usual/correct to use variables where the first letter references their typing? Ex.: string sVariavel; int iVariavel;, etc.... EDIT: The name of it is hungarian notation. Is that good practice?…
-
16
votes3
answers4507
viewsWhat is the point of "interrogation" in the type statement in C#?
I saw this code written in C# on the Internet: namespace Test { [MicroEntitySetup(TableName = "Users")] public class User : MicroEntity<User> { [Key] public int id { get; set; } public string…
-
15
votes3
answers70810
viewsWhat are the appropriate data types for columns like address, email, phone and mobile phone for SQL database?
What kind of data are recommended to create the following fields: address, email, mobile number/phone?
-
15
votes1
answer167
viewsWhat is the character function ? in the variable type in C#?
I see many third-party codes and I often see the use of the question mark on the type of the variable. Example: public bool? Status Could someone explain to me the difference between not having this…
-
15
votes2
answers2209
viewsWhat is typing style?
On Wikipedia, on the page about C# says about the "typing style" of the language: static and dynamic, strong, safe and insecure, nominative, partially inferent What is typing style? What do the…
-
15
votes2
answers1034
viewsWhy does the absence of the suffix L cause the long variable to be interpreted as int?
When I use a short number for long, as long long1 = 9797;, the number is accepted even without using the suffix L. However, by placing a higher number - as its minimum and maximum values, for…
-
14
votes2
answers341
viewsFirst-class functions: Why should input types be counter-variants?
To demonstrate the problem I will use Scala code (although this is a rule formalized by Luca Cardelli). trait Function1[-A, +R] { def apply(x: A): R } In Scala this means that a function with an…
-
14
votes5
answers1721
viewsIs it possible to change the type of the variable in Java?
Is it possible to change the type of my variable in Java? For example, I created a variable x, she being a Double: double x; I want to continue using my variable x but she is now a int: int x;…
-
14
votes2
answers511
viewsWhat are nesting guys for?
I know that C# supports nested types, that is, it is possible for me to declare one class within another. For example: public class A { // Propriedades e métodos da classe A public class B { //…
-
14
votes2
answers2102
viewsint and Integer - Java
I’m developing a project in Java and he’s in error, I’ve found it but I don’t understand it. public class Time{ private String nome; private ArrayList<Jogador> jogadores; private Integer gols;…
-
14
votes4
answers3299
viewsTyping the return in PHP 7. What are the advantages?
I was giving a test in PHP 7 and I checked that the same now accepts to define which type of data will be returned. Here are some tests: Defining the instance to be returned function test_object():…
-
14
votes5
answers13398
views -
14
votes1
answer497
viewsShould I use the ushort, uint and ulong types whenever the number is equal to or greater than 0?
Is it good practice or is there something from Microsoft recommending the use of ushort, uint and ulong whenever I am sure that the value will be equal to or greater than 0? I can gain some…
-
14
votes2
answers128
viewsWhat are they and when to use Anonymous Unions?
During the data structure book reading, it was briefly presented the concept of anonymous unions, which would be the definition of a union without specifying a label (name). However, I did not…
-
14
votes1
answer335
viewsWhy don’t we have a 128-bit Integer?
We have 16, 32 and 64 bit integer values. short, int and long, respectively. But why don’t we have 128 integers? Or 256 integers? I ask this in case we need to keep an extremely large number that…
-
13
votes4
answers20996
viewsDifference between null, Empty, 0 and false
The goal Differentiate the day-to-day use of null, empty, 0 and false. The problem Dealing every day with these 4 representations of variables is complicated and I don’t know how to differentiate…
-
13
votes2
answers995
viewsPHP 7 has argument typing and return, but is it optional. Is that good or bad?
I would not like to raise here a controversial issue regarding the PHP 7 language, which was released recently, but only understand a few points regarding typing. Come on: In versions prior to PHP…
-
12
votes3
answers419
viewsAssign type to parameters
It is possible to assign types for the parameters in functions in PHP? Example: public function random(int $length) { // ... }
-
12
votes2
answers231
viewsWhat does " | " mean in Typescript?
I have the following code: export type Teste = Observable<'exemplo' | any>; What the bar means | within the generic argument? Is some kind of comparison any and the string for example?…
-
11
votes2
answers3208
viewsDifferences and use of Strings vs. Charsequence
Many methods in Java expect parameters CharSequence, but the code runs normally when I pass a String without conversion, for example: String mensagem = intent.getStringExtra(MainActivity.MENSAGEM);…
-
11
votes2
answers8942
viewsHow to verify if a variable is float, decimal or integer in Javascript?
I tried with typeof(), but it only returns to me if it is a number, string, etc.. It would be something like that: var x = 1.2; if (x == inteiro){ alert("x é um inteiro"); }…
-
11
votes2
answers10914
viewsData type for latitude and longitude
I am working on a new project where I will need to save the coordinates (latitude and longitude) of an address in the database. There is an ideal data type for this? I searched and saw some decimal…
-
11
votes3
answers485
viewsC++ - What’s the difference of using fixed C++ and typedef types of a type?
A few days ago studying about emulation I came across a question in the English stack overflow about CHIP8 emulation, and one of the answers said not to use C arrays as for example int i[12] instead…